diff --git a/changelog.d/audio/3123.bugfix.rst b/changelog.d/audio/3123.bugfix.rst new file mode 100644 index 000000000..e639ae043 --- /dev/null +++ b/changelog.d/audio/3123.bugfix.rst @@ -0,0 +1 @@ +Fix a console spam caused sometimes when auto disconnect and auto pause are used. \ No newline at end of file diff --git a/redbot/cogs/audio/audio.py b/redbot/cogs/audio/audio.py index 6bb3229df..00af5e97e 100644 --- a/redbot/cogs/audio/audio.py +++ b/redbot/cogs/audio/audio.py @@ -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 )