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