mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-08 18:32:32 -05:00
Fix crash in [p]audiostats by using the new connected_at attr (#5046)
* This PR depends on Part 1 due to new `Player.guild` attribute and RLL bump to 0.8.1 - [player.store] notify_channel->channel - [player.store] removed guild - [player.store] removed connect - changes in [p]audiostats Co-authored-by: alec <50505980+aleclol@users.noreply.github.com> * another one * Update redbot/cogs/audio/core/commands/miscellaneous.py Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> * style Co-authored-by: alec <50505980+aleclol@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -196,7 +196,7 @@ class AudioEvents(MixinMeta, metaclass=CompositeMetaClass):
|
||||
requester: discord.Member,
|
||||
player: lavalink.Player,
|
||||
):
|
||||
notify_channel = self.bot.get_channel(player.fetch("channel"))
|
||||
notify_channel = self.bot.get_channel(player.fetch("notify_channel"))
|
||||
has_perms = self._has_notify_perms(notify_channel)
|
||||
tries = 0
|
||||
while not player._is_playing:
|
||||
|
||||
@@ -90,9 +90,9 @@ class DpyEvents(MixinMeta, metaclass=CompositeMetaClass):
|
||||
|
||||
with contextlib.suppress(Exception):
|
||||
player = lavalink.get_player(ctx.guild.id)
|
||||
notify_channel = player.fetch("channel")
|
||||
notify_channel = player.fetch("notify_channel")
|
||||
if not notify_channel:
|
||||
player.store("channel", ctx.channel.id)
|
||||
player.store("notify_channel", ctx.channel.id)
|
||||
|
||||
self._daily_global_playlist_cache.setdefault(
|
||||
self.bot.user.id, await self.config.daily_playlists()
|
||||
|
||||
@@ -120,7 +120,7 @@ class LavalinkEvents(MixinMeta, metaclass=CompositeMetaClass):
|
||||
await self.api_interface.persistent_queue_api.played(
|
||||
guild_id=guild_id, track_id=current_track.track_identifier
|
||||
)
|
||||
notify_channel = player.fetch("channel")
|
||||
notify_channel = player.fetch("notify_channel")
|
||||
if notify_channel and autoplay:
|
||||
await self.config.guild_from_id(guild_id=guild_id).currently_auto_playing_in.set(
|
||||
[notify_channel, player.channel.id]
|
||||
@@ -145,7 +145,7 @@ class LavalinkEvents(MixinMeta, metaclass=CompositeMetaClass):
|
||||
and self.playlist_api is not None
|
||||
and self.api_interface is not None
|
||||
):
|
||||
notify_channel_id = player.fetch("channel")
|
||||
notify_channel_id = player.fetch("notify_channel")
|
||||
try:
|
||||
await self.api_interface.autoplay(player, self.playlist_api)
|
||||
except DatabaseError:
|
||||
@@ -168,7 +168,7 @@ class LavalinkEvents(MixinMeta, metaclass=CompositeMetaClass):
|
||||
)
|
||||
return
|
||||
if event_type == lavalink.LavalinkEvents.TRACK_START and notify:
|
||||
notify_channel_id = player.fetch("channel")
|
||||
notify_channel_id = player.fetch("notify_channel")
|
||||
notify_channel = self.bot.get_channel(notify_channel_id)
|
||||
if notify_channel and self._has_notify_perms(notify_channel):
|
||||
if player.fetch("notify_message") is not None:
|
||||
@@ -207,7 +207,7 @@ class LavalinkEvents(MixinMeta, metaclass=CompositeMetaClass):
|
||||
|
||||
if event_type == lavalink.LavalinkEvents.QUEUE_END:
|
||||
if not autoplay:
|
||||
notify_channel_id = player.fetch("channel")
|
||||
notify_channel_id = player.fetch("notify_channel")
|
||||
notify_channel = self.bot.get_channel(notify_channel_id)
|
||||
if notify_channel and notify and self._has_notify_perms(notify_channel):
|
||||
await self.send_embed_msg(notify_channel, title=_("Queue ended."))
|
||||
@@ -226,7 +226,7 @@ class LavalinkEvents(MixinMeta, metaclass=CompositeMetaClass):
|
||||
lavalink.LavalinkEvents.TRACK_EXCEPTION,
|
||||
lavalink.LavalinkEvents.TRACK_STUCK,
|
||||
]:
|
||||
message_channel = player.fetch("channel")
|
||||
message_channel = player.fetch("notify_channel")
|
||||
while True:
|
||||
if current_track in player.queue:
|
||||
player.queue.remove(current_track)
|
||||
|
||||
Reference in New Issue
Block a user