fix when no controller

This commit is contained in:
Mylloon 2021-08-16 19:29:49 +02:00
parent f98ed172c1
commit 4cfa321a53

View file

@ -163,7 +163,7 @@ class Player(wavelink.Player):
embed.add_field(name="Volume", value=f"**`{self.volume}%`**")
embed.add_field(name="Demandé par", value=track.requester.mention)
embed.add_field(name="DJ", value=self.dj.mention)
embed.add_field(name="Lien de la vidéo", value=f"[Clique ici]({track.uri})")
embed.add_field(name="Lien vidéo", value=f"[Clique ici]({track.uri})")
return embed
@ -180,12 +180,13 @@ class Player(wavelink.Player):
async def teardown(self):
"""Clear internal states, remove player controller and disconnect."""
try:
await self.controller.message.delete()
except discord.HTTPException:
pass
if self.controller:
try:
await self.controller.message.delete()
except discord.HTTPException:
pass
self.controller.stop()
self.controller.stop()
try:
await self.destroy()
@ -481,7 +482,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
if channel is None:
raise NoChannelProvided
await player.connect(channel.id)
await player.connect(channel.id, self_deaf = True)
await ctx.send(f":thumbsup: **Connecté à __{channel.name}__**")
if fromSlash != True:
return await addReaction(ctx.message, 1)