From 730a42350ecb2ef463c21357cda1ed8af357934e Mon Sep 17 00:00:00 2001 From: Ev-1 <33662061+Ev-1@users.noreply.github.com> Date: Thu, 13 Oct 2022 20:45:53 +0200 Subject: [PATCH] Fix bug when using force disconnect would cause exception --- musicbot/cogs/music/voice_client.py | 9 ++++++--- musicbot/utils/userinteraction/scroller.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/musicbot/cogs/music/voice_client.py b/musicbot/cogs/music/voice_client.py index cfdaf73..52f1855 100644 --- a/musicbot/cogs/music/voice_client.py +++ b/musicbot/cogs/music/voice_client.py @@ -7,10 +7,13 @@ from musicbot.cogs.music.music_errors import MusicError class BasicVoiceClient(discord.VoiceClient): def __init__(self, client: MusicBot, channel: discord.VoiceChannel): - self.music_bot = client + # Needs to be named client in order for base class to work + # in most cases lavalink handles disconnects, but if we force it then we'll get an error. + # during self.cleanup() + self.client = client self.channel = channel - if self.music_bot.lavalink: - self.lavalink = self.music_bot.lavalink + if self.client.lavalink: + self.lavalink = self.client.lavalink else: raise MusicError("client did not have defined lavalink before connect") diff --git a/musicbot/utils/userinteraction/scroller.py b/musicbot/utils/userinteraction/scroller.py index 3d1eec7..2fd84ba 100644 --- a/musicbot/utils/userinteraction/scroller.py +++ b/musicbot/utils/userinteraction/scroller.py @@ -105,7 +105,7 @@ class Scroller: await self.scrolling_done.wait() return self.message - def update_view_on_interaction(self, interaction: discord.Interaction): + def update_view_on_interaction(self, _: discord.Interaction): self.update_view() def update_view(self):