mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Audio] Fix console spam caused by disconnect_timer if a player is destroyed before the task completes (#3123)
* Remove servers from the auto disconnect/pause list is their players no longer exist... Prevents a console spam Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Chore Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
parent
0b042532fd
commit
6bf9ff5637
1
changelog.d/audio/3123.bugfix.rst
Normal file
1
changelog.d/audio/3123.bugfix.rst
Normal file
@ -0,0 +1 @@
|
||||
Fix a console spam caused sometimes when auto disconnect and auto pause are used.
|
||||
@ -6749,8 +6749,10 @@ class Audio(commands.Cog):
|
||||
player = lavalink.get_player(sid)
|
||||
await player.stop()
|
||||
await player.disconnect()
|
||||
except Exception:
|
||||
except Exception as err:
|
||||
log.error("Exception raised in Audio's emptydc_timer.", exc_info=True)
|
||||
if "No such player for that guild" in str(err):
|
||||
stop_times.pop(sid, None)
|
||||
pass
|
||||
elif (
|
||||
sid in pause_times and await self.config.guild(server_obj).emptypause_enabled()
|
||||
@ -6759,7 +6761,9 @@ class Audio(commands.Cog):
|
||||
if (time.time() - pause_times.get(sid)) >= emptypause_timer:
|
||||
try:
|
||||
await lavalink.get_player(sid).pause()
|
||||
except Exception:
|
||||
except Exception as err:
|
||||
if "No such player for that guild" in str(err):
|
||||
pause_times.pop(sid, None)
|
||||
log.error(
|
||||
"Exception raised in Audio's emptypause_timer.", exc_info=True
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user