mysendhidden everywhere

This commit is contained in:
Mylloon 2021-08-16 17:01:45 +02:00
parent d4ed846cb5
commit c0aa999cbd

View file

@ -475,8 +475,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if player.is_connected: if player.is_connected:
if fromSlash: mySendHidden(ctx, fromSlash, "Déjà connecté.")
await ctx.send("Déjà connecté.", hidden = True)
return return
channel = getattr(ctx.author.voice, 'channel', channel) channel = getattr(ctx.author.voice, 'channel', channel)
@ -500,7 +499,10 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
channel = getattr(ctx.author.voice, 'channel') try:
channel = getattr(ctx.author.voice, 'channel')
except:
return await mySendHidden(ctx, fromSlash, "Tu n'es connecté à aucun salon vocal.")
if channel is None: if channel is None:
raise NoChannelProvided raise NoChannelProvided
await self.connect(ctx = ctx, channel = channel, fromSlash = True) await self.connect(ctx = ctx, channel = channel, fromSlash = True)
@ -539,8 +541,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if player.is_paused or not player.is_connected: if player.is_paused or not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if self.is_privileged(ctx): if self.is_privileged(ctx):
@ -569,8 +570,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_paused or not player.is_connected: if not player.is_paused or not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique en pause n'est en cours.")
await ctx.send("Aucune musique en pause n'est en cours.", hidden = True)
return return
if self.is_privileged(ctx): if self.is_privileged(ctx):
@ -599,8 +599,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if self.is_privileged(ctx) or ctx.author == player.current.requester: if self.is_privileged(ctx) or ctx.author == player.current.requester:
@ -629,13 +628,11 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if self.is_privileged(ctx): if self.is_privileged(ctx):
await ctx.send(f"{ctx.author.mention} a déconnecter le bot et supprimer la file d'attente.", delete_after=10) await ctx.send(f"{ctx.author.mention} a déconnecter le bot et supprimer la file d'attente.", delete_after=10)
print("x")
return await player.teardown() return await player.teardown()
required = self.required(ctx) required = self.required(ctx)
@ -660,8 +657,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
return await mySendHidden(ctx, fromSlash, f"Le volume est actuellement réglé à **{player.volume}%**.") return await mySendHidden(ctx, fromSlash, f"Le volume est actuellement réglé à **{player.volume}%**.")
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if not self.is_privileged(ctx): if not self.is_privileged(ctx):
@ -683,8 +679,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if player.queue.qsize() < 3: if player.queue.qsize() < 3:
@ -708,7 +703,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
async def _shuffle(self, ctx): async def _shuffle(self, ctx):
return await self.shuffle(ctx = ctx, fromSlash = True) return await self.shuffle(ctx = ctx, fromSlash = True)
@commands.command(hidden=True) @commands.command(hidden = True)
async def vol_up(self, ctx: commands.Context): async def vol_up(self, ctx: commands.Context):
"""Command used for volume up button.""" """Command used for volume up button."""
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
@ -724,7 +719,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await player.set_volume(vol) await player.set_volume(vol)
@commands.command(hidden=True) @commands.command(hidden = True)
async def vol_down(self, ctx: commands.Context): async def vol_down(self, ctx: commands.Context):
"""Command used for volume down button.""" """Command used for volume down button."""
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
@ -747,8 +742,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if not self.is_privileged(ctx): if not self.is_privileged(ctx):
@ -777,8 +771,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if player.queue.qsize() == 0: if player.queue.qsize() == 0:
@ -788,7 +781,8 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
pages = PaginatorSource(entries=entries) pages = PaginatorSource(entries=entries)
paginator = menus.MenuPages(source=pages, timeout=None, delete_message_after=True) paginator = menus.MenuPages(source=pages, timeout=None, delete_message_after=True)
await ctx.send("Affichage de la liste ci-dessous.", hidden = True) if fromSlash:
await ctx.send("Affichage de la liste ci-dessous.", hidden = True)
await paginator.start(ctx) await paginator.start(ctx)
@cog_ext.cog_slash(name="queue", description = "Affiche les sons en attente.") @cog_ext.cog_slash(name="queue", description = "Affiche les sons en attente.")
async def _queue(self, ctx,): async def _queue(self, ctx,):
@ -801,8 +795,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
await player.invoke_controller() await player.invoke_controller()
@ -819,8 +812,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not player.is_connected: if not player.is_connected:
if fromSlash: await mySendHidden(ctx, fromSlash, "Aucune musique n'est en cours.")
await ctx.send("Aucune musique n'est en cours.", hidden = True)
return return
if not self.is_privileged(ctx): if not self.is_privileged(ctx):