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:
Draper
2021-05-19 16:56:53 +01:00
committed by GitHub
parent 439033ea28
commit 3a9edd9434
12 changed files with 56 additions and 116 deletions

View File

@@ -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(

View File

@@ -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):