diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-20 15:21:37 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-20 15:21:37 +0200 |
| commit | 1f37a67c53233dc8e814d22620e1ff8a6fdb14b6 (patch) | |
| tree | 42062b7e90cda16bd25091ff9c31046d18b6029c /cogs/music/audio_playback.py | |
| parent | proper context for settings (diff) | |
| download | senator-sperma-1f37a67c53233dc8e814d22620e1ff8a6fdb14b6.tar.gz senator-sperma-1f37a67c53233dc8e814d22620e1ff8a6fdb14b6.zip | |
health checks for vc
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to '')
| -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) |
