mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-09 02:42:30 -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:
@@ -103,10 +103,6 @@ class FormattingUtilities(MixinMeta, metaclass=CompositeMetaClass):
|
||||
ctx.author.voice.channel,
|
||||
deafen=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
|
||||
)
|
||||
player = lavalink.get_player(ctx.guild.id)
|
||||
player.store("connect", datetime.datetime.utcnow())
|
||||
player.store("channel", ctx.channel.id)
|
||||
player.store("guild", ctx.guild.id)
|
||||
except AttributeError:
|
||||
return await self.send_embed_msg(ctx, title=_("Connect to a voice channel first."))
|
||||
except IndexError:
|
||||
@@ -114,6 +110,7 @@ class FormattingUtilities(MixinMeta, metaclass=CompositeMetaClass):
|
||||
ctx, title=_("Connection to Lavalink has not yet been established.")
|
||||
)
|
||||
player = lavalink.get_player(ctx.guild.id)
|
||||
player.store("notify_channel", ctx.channel.id)
|
||||
guild_data = await self.config.guild(ctx.guild).all()
|
||||
if len(player.queue) >= 10000:
|
||||
return await self.send_embed_msg(
|
||||
|
||||
@@ -546,10 +546,6 @@ class PlaylistUtilities(MixinMeta, metaclass=CompositeMetaClass):
|
||||
ctx.author.voice.channel,
|
||||
deafen=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
|
||||
)
|
||||
player = lavalink.get_player(ctx.guild.id)
|
||||
player.store("connect", datetime.datetime.utcnow())
|
||||
player.store("channel", ctx.channel.id)
|
||||
player.store("guild", ctx.guild.id)
|
||||
except IndexError:
|
||||
await self.send_embed_msg(
|
||||
ctx,
|
||||
@@ -564,10 +560,8 @@ class PlaylistUtilities(MixinMeta, metaclass=CompositeMetaClass):
|
||||
description=_("Connect to a voice channel first."),
|
||||
)
|
||||
return False
|
||||
|
||||
player = lavalink.get_player(ctx.guild.id)
|
||||
player.store("channel", ctx.channel.id)
|
||||
player.store("guild", ctx.guild.id)
|
||||
player.store("notify_channel", ctx.channel.id)
|
||||
if (
|
||||
not ctx.author.voice or ctx.author.voice.channel != player.channel
|
||||
) and not await self._can_instaskip(ctx, ctx.author):
|
||||
|
||||
Reference in New Issue
Block a user