diff options
Diffstat (limited to 'cogs/music/audio_playback.py')
| -rw-r--r-- | cogs/music/audio_playback.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cogs/music/audio_playback.py b/cogs/music/audio_playback.py index 1313d01..0c885c3 100644 --- a/cogs/music/audio_playback.py +++ b/cogs/music/audio_playback.py | |||
| @@ -173,6 +173,18 @@ class AudioPlaybackManager: | |||
| 173 | vc = await target_channel.connect() | 173 | vc = await target_channel.connect() |
| 174 | except discord.ClientException: | 174 | except discord.ClientException: |
| 175 | vc = discord.utils.get(ctx.bot.voice_clients, guild=guild) | 175 | vc = discord.utils.get(ctx.bot.voice_clients, guild=guild) |
| 176 | elif vc.channel == target_channel: | ||
| 177 | from cogs.voice import is_voice_client_alive | ||
| 178 | if not is_voice_client_alive(vc, guild): | ||
| 179 | logger.warning("Stale voice client, reconnecting...") | ||
| 180 | try: | ||
| 181 | await vc.disconnect() | ||
| 182 | except Exception: | ||
| 183 | pass | ||
| 184 | try: | ||
| 185 | vc = await target_channel.connect() | ||
| 186 | except discord.ClientException: | ||
| 187 | vc = discord.utils.get(ctx.bot.voice_clients, guild=guild) | ||
| 176 | elif vc.channel != target_channel: | 188 | elif vc.channel != target_channel: |
| 177 | logger.info(f"Moving to voice channel: {target_channel.name}") | 189 | logger.info(f"Moving to voice channel: {target_channel.name}") |
| 178 | await vc.move_to(target_channel) | 190 | await vc.move_to(target_channel) |
