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

@@ -129,11 +129,8 @@ class StartUpTasks(MixinMeta, metaclass=CompositeMetaClass):
if not (perms.connect and perms.speak):
vc = None
break
await lavalink.connect(vc, deafen=auto_deafen)
player = lavalink.get_player(guild.id)
player.store("connect", datetime.datetime.utcnow())
player.store("guild", guild_id)
player.store("channel", notify_channel_id)
player = await lavalink.connect(vc, deafen=auto_deafen)
player.store("notify_channel", notify_channel_id)
break
except IndexError:
await asyncio.sleep(5)
@@ -201,11 +198,8 @@ class StartUpTasks(MixinMeta, metaclass=CompositeMetaClass):
if not (perms.connect and perms.speak):
vc = None
break
await lavalink.connect(vc, deafen=auto_deafen)
player = lavalink.get_player(guild.id)
player.store("connect", datetime.datetime.utcnow())
player.store("guild", guild_id)
player.store("channel", notify_channel_id)
player = await lavalink.connect(vc, deafen=auto_deafen)
player.store("notify_channel", notify_channel_id)
break
except IndexError:
await asyncio.sleep(5)
@@ -228,7 +222,7 @@ class StartUpTasks(MixinMeta, metaclass=CompositeMetaClass):
player.maybe_shuffle()
log.info("Restored %r", player)
if not player.is_playing:
notify_channel = player.fetch("channel")
notify_channel = player.fetch("notify_channel")
try:
await self.api_interface.autoplay(player, self.playlist_api)
except DatabaseError: