diff --git a/redbot/cogs/audio/core/events/cog.py b/redbot/cogs/audio/core/events/cog.py index 1a01cd2560b6..ba15827cf38e 100644 --- a/redbot/cogs/audio/core/events/cog.py +++ b/redbot/cogs/audio/core/events/cog.py @@ -206,7 +206,7 @@ async def on_red_audio_track_auto_play( if notify_channel and has_perms and not player.fetch("autoplay_notified", False): if ( - len(player.manager.players) < 10 + len(player.node.players) < 10 or not player._last_resume and player._last_resume + datetime.timedelta(seconds=60) > datetime.datetime.now(tz=datetime.timezone.utc) diff --git a/redbot/cogs/audio/core/events/lavalink.py b/redbot/cogs/audio/core/events/lavalink.py index 4f3586f4e771..cbafe053dcf8 100644 --- a/redbot/cogs/audio/core/events/lavalink.py +++ b/redbot/cogs/audio/core/events/lavalink.py @@ -7,7 +7,6 @@ import discord import lavalink from discord.backoff import ExponentialBackoff -from discord.gateway import DiscordWebSocket from red_commons.logging import getLogger from redbot.core.i18n import Translator, set_contextual_locales_from_guild @@ -333,14 +332,13 @@ async def _websocket_closed_handler( disconnect: bool, ) -> None: guild_id = guild.id + shard = self.bot.shards[guild.shard_id] event_channel_id = extra.get("channelID") try: if not self._ws_resume[guild_id].is_set(): await self._ws_resume[guild_id].wait() else: self._ws_resume[guild_id].clear() - node = player.node - voice_ws: DiscordWebSocket = node.get_voice_ws(guild_id) code = extra.get("code") by_remote = extra.get("byRemote", "") reason = extra.get("reason", "No Specified Reason").strip() @@ -380,7 +378,7 @@ async def _websocket_closed_handler( self._ws_op_codes[guild_id]._init(self._ws_op_codes[guild_id]._maxsize) return - if voice_ws.socket._closing or voice_ws.socket.closed or not voice_ws.open: + if shard.is_closed(): if player._con_delay: delay = player._con_delay.delay() else: @@ -392,7 +390,7 @@ async def _websocket_closed_handler( "Socket Closed %s. " "Code: %d -- Remote: %s -- %s, %r", guild_id, - voice_ws.socket._closing or voice_ws.socket.closed, + shard.is_closed(), code, by_remote, reason, @@ -405,8 +403,7 @@ async def _websocket_closed_handler( delay, ) await asyncio.sleep(delay) - while voice_ws.socket._closing or voice_ws.socket.closed or not voice_ws.open: - voice_ws = node.get_voice_ws(guild_id) + while shard.is_closed(): await asyncio.sleep(0.1) if has_perm and player.current and player.is_playing: diff --git a/setup.cfg b/setup.cfg index 92fd5fb3566e..1b6d4b8fb7d5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,7 +67,7 @@ install_requires = pytz==2021.1 PyYAML==5.4.1 Red-Commons==1.0.0 - Red-Lavalink==0.9.0 + Red-Lavalink @ git+https://github.com/Cog-Creators/Red-Lavalink@dpy2_unstable#egg=Red-Lavalink rich==10.9.0 schema==0.7.4 six==1.16.0