From 194cdae2244cd108904c8ac4bd5f8f6fd07e49a6 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 16 Aug 2021 09:34:12 +0200 Subject: [PATCH] adding translation to FR and better help and some aliases --- src/cogs/music.py | 123 +++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/src/cogs/music.py b/src/cogs/music.py index 6a3ad72..777c3f7 100644 --- a/src/cogs/music.py +++ b/src/cogs/music.py @@ -323,7 +323,7 @@ class PaginatorSource(menus.ListPageSource): class Music(commands.Cog, wavelink.WavelinkMixin): - """Music Cog.""" + """Commandes de musique.""" def __init__(self, bot: commands.Bot): self.bot = bot @@ -337,6 +337,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin): else: self.url = "localhost" # localhost + print("Préparation des nodes Lavalink ...", end = " ") self.bot.loop.create_task(self.start_nodes()) async def start_nodes(self) -> None: @@ -371,7 +372,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin): @wavelink.WavelinkMixin.listener() async def on_node_ready(self, node: wavelink.Node): - print(f'Node {node.identifier} is ready!') + print(f'Node Lavalink \"{node.identifier}\" est prête !') @wavelink.WavelinkMixin.listener('on_track_stuck') @wavelink.WavelinkMixin.listener('on_track_end') @@ -409,12 +410,12 @@ class Music(commands.Cog, wavelink.WavelinkMixin): return if isinstance(error, NoChannelProvided): - return await ctx.send('You must be in a voice channel or provide one to connect to.') + return await ctx.send("Vous devez être dans un channel vocal ou m'en donner un pour m'y connecter.") async def cog_check(self, ctx: commands.Context): """Cog wide check, which disallows commands in DMs.""" if not ctx.guild: - await ctx.send('Music commands are not available in Private Messages.') + await ctx.send("Les commandes de musique ne sont pas disponibles dans les messages privés.") return False return True @@ -427,10 +428,10 @@ class Music(commands.Cog, wavelink.WavelinkMixin): if player.context: if player.context.channel != ctx.channel: - await ctx.send(f'{ctx.author.mention}, you must be in {player.context.channel.mention} for this session.') + await ctx.send(f"{ctx.author.mention}, vous devez être dans {player.context.channel.mention} pour cette session.") raise IncorrectChannelError - if ctx.command.name == 'connect' and not player.context: + if ctx.command.name == "connect" and not player.context: return elif self.is_privileged(ctx): return @@ -444,7 +445,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin): if player.is_connected: if ctx.author not in channel.members: - await ctx.send(f'{ctx.author.mention}, you must be in `{channel.name}` to use voice commands.') + await ctx.send(f'{ctx.author.mention}, vous devez être dans `{channel.name}` pour utiliser les commandes de musique.') raise IncorrectChannelError def required(self, ctx: commands.Context): @@ -465,9 +466,9 @@ class Music(commands.Cog, wavelink.WavelinkMixin): return player.dj == ctx.author or ctx.author.guild_permissions.kick_members - @commands.command() + @commands.command(aliases=["join", "j"]) async def connect(self, ctx: commands.Context, *, channel: typing.Union[discord.VoiceChannel, discord.StageChannel] = None): - """Connect to a voice channel.""" + """Connexion à un channel vocal.\n ➡ Syntaxe: {PREFIX}connect/join/j""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if player.is_connected: @@ -479,9 +480,9 @@ class Music(commands.Cog, wavelink.WavelinkMixin): await player.connect(channel.id) - @commands.command() + @commands.command(aliases=["p"]) async def play(self, ctx: commands.Context, *, query: str): - """Play or queue a song with the given query.""" + """Joue ou met dans la file d'attente un son avec la requête donnée.\n ➡ Syntaxe: {PREFIX}play/p""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: @@ -493,18 +494,19 @@ class Music(commands.Cog, wavelink.WavelinkMixin): tracks = await self.bot.wavelink.get_tracks(query) if not tracks: - return await ctx.send('No songs were found with that query. Please try again.', delete_after=15) + return await ctx.send("Aucun son n'a été trouvée avec cette requête. Veuillez réessayer.", delete_after=15) if isinstance(tracks, wavelink.TrackPlaylist): for track in tracks.tracks: track = Track(track.id, track.info, requester=ctx.author) await player.queue.put(track) - - await ctx.send(f'```ini\nAdded the playlist {tracks.data["playlistInfo"]["name"]}' - f' with {len(tracks.tracks)} songs to the queue.\n```', delete_after=15) + + lenghtTracks = len(tracks.tracks) + await ctx.send(f"```ini\nAjout de la playlist {tracks.data["playlistInfo"]["name"]}" + f" avec {lenghtTracks} son{'s' if lenghtTracks > 1 else ''} à la file d'attente.```", delete_after=15) else: track = Track(tracks[0].id, tracks[0].info, requester=ctx.author) - await ctx.send(f'```ini\nAdded {track.title} to the Queue\n```', delete_after=15) + await ctx.send(f"```ini\nAjout de {track.title} à la file d'attente```", delete_after=15) await player.queue.put(track) if not player.is_playing: @@ -512,14 +514,14 @@ class Music(commands.Cog, wavelink.WavelinkMixin): @commands.command() async def pause(self, ctx: commands.Context): - """Pause the currently playing song.""" + """Met en pause du son en cours.""" 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: return if self.is_privileged(ctx): - await ctx.send('An admin or DJ has paused the player.', delete_after=10) + await ctx.send("Un admin ou un DJ a mis la musique en pause.", delete_after=10) player.pause_votes.clear() return await player.set_pause(True) @@ -528,22 +530,22 @@ class Music(commands.Cog, wavelink.WavelinkMixin): player.pause_votes.add(ctx.author) if len(player.pause_votes) >= required: - await ctx.send('Vote to pause passed. Pausing player.', delete_after=10) + await ctx.send("Mise en pause votée. Musique mis en pause.", delete_after=10) player.pause_votes.clear() await player.set_pause(True) else: - await ctx.send(f'{ctx.author.mention} has voted to pause the player.', delete_after=15) + await ctx.send(f"{ctx.author.mention} a voté pour mettre la musique en pause.", delete_after=15) @commands.command() async def resume(self, ctx: commands.Context): - """Resume a currently paused player.""" + """Reprend la musique en pause.""" 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: return if self.is_privileged(ctx): - await ctx.send('An admin or DJ has resumed the player.', delete_after=10) + await ctx.send("Un admin ou un DJ a mis la musique en pause.", delete_after=10) player.resume_votes.clear() return await player.set_pause(False) @@ -552,28 +554,28 @@ class Music(commands.Cog, wavelink.WavelinkMixin): player.resume_votes.add(ctx.author) if len(player.resume_votes) >= required: - await ctx.send('Vote to resume passed. Resuming player.', delete_after=10) + await ctx.send("Mise en pause votée. Musique relancée.", delete_after=10) player.resume_votes.clear() await player.set_pause(False) else: - await ctx.send(f'{ctx.author.mention} has voted to resume the player.', delete_after=15) + await ctx.send(f'{ctx.author.mention} a voté pour relancer la musique.', delete_after=15) - @commands.command() + @commands.command(aliases=["s"]) async def skip(self, ctx: commands.Context): - """Skip the currently playing song.""" + """Skip le son en cours.\n ➡ Syntaxe: {PREFIX}skip/s""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: return if self.is_privileged(ctx): - await ctx.send('An admin or DJ has skipped the song.', delete_after=10) + await ctx.send("Un admin ou un DJ a skip le son.", delete_after=10) player.skip_votes.clear() return await player.stop() if ctx.author == player.current.requester: - await ctx.send('The song requester has skipped the song.', delete_after=10) + await ctx.send("La personne qui avait mit le son l'a skip.", delete_after=10) player.skip_votes.clear() return await player.stop() @@ -582,63 +584,63 @@ class Music(commands.Cog, wavelink.WavelinkMixin): player.skip_votes.add(ctx.author) if len(player.skip_votes) >= required: - await ctx.send('Vote to skip passed. Skipping song.', delete_after=10) + await ctx.send("Vote pour skip le son adoptée, skip de le son.", delete_after=10) player.skip_votes.clear() await player.stop() else: - await ctx.send(f'{ctx.author.mention} has voted to skip the song.', delete_after=15) + await ctx.send(f"{ctx.author.mention} a voté pour skip le son.", delete_after=15) - @commands.command() + @commands.command(aliases=["disconnect", "discon"]) async def stop(self, ctx: commands.Context): - """Stop the player and clear all internal states.""" + """Stop le son et supprime la file d'attente.\n ➡ Syntaxe: {PREFIX}stop/disconnect/discon""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: return if self.is_privileged(ctx): - await ctx.send('An admin or DJ has stopped the player.', delete_after=10) + await ctx.send("Un admin ou un DJ arrêter le son et supprimer la file d'attente.", delete_after=10) return await player.teardown() required = self.required(ctx) player.stop_votes.add(ctx.author) if len(player.stop_votes) >= required: - await ctx.send('Vote to stop passed. Stopping the player.', delete_after=10) + await ctx.send("Arrêt voté. Arrêt du son et suppression de la file d'attente.", delete_after=10) await player.teardown() else: - await ctx.send(f'{ctx.author.mention} has voted to stop the player.', delete_after=15) + await ctx.send(f"{ctx.author.mention} a voté pour arrêter d'écouter de la musique.", delete_after=15) @commands.command(aliases=['v', 'vol']) async def volume(self, ctx: commands.Context, *, vol: int): - """Change the players volume, between 1 and 100.""" + """Modifiez le volume du lecteur.\n ➡ Syntaxe: {PREFIX}volume/vol/v (1-100)""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: return if not self.is_privileged(ctx): - return await ctx.send('Only the DJ or admins may change the volume.') + return await ctx.send("Seuls le DJ ou les admins peuvent modifier le volume.") if not 0 < vol < 101: - return await ctx.send('Please enter a value between 1 and 100.') + return await ctx.send("Veuillez saisir une valeur comprise entre 1 et 100.") await player.set_volume(vol) - await ctx.send(f'Set the volume to **{vol}**%', delete_after=7) + await ctx.send(f"Volume réglé à **{vol}**%.", delete_after=7) @commands.command(aliases=['mix']) async def shuffle(self, ctx: commands.Context): - """Shuffle the players queue.""" + """Mélange les sons en file d'attente. (mini 3 sons en file d'attente)\n ➡ Syntaxe: {PREFIX}shuffle/mix""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: return if player.queue.qsize() < 3: - return await ctx.send('Add more songs to the queue before shuffling.', delete_after=15) + return await ctx.send("Ajoutez d'autres sons à la file d'attente avant de les mélanger.", delete_after=15) if self.is_privileged(ctx): - await ctx.send('An admin or DJ has shuffled the playlist.', delete_after=10) + await ctx.send("Un admin ou un DJ a mélangé la liste de lecture.", delete_after=10) player.shuffle_votes.clear() return random.shuffle(player.queue._queue) @@ -646,11 +648,11 @@ class Music(commands.Cog, wavelink.WavelinkMixin): player.shuffle_votes.add(ctx.author) if len(player.shuffle_votes) >= required: - await ctx.send('Vote to shuffle passed. Shuffling the playlist.', delete_after=10) + await ctx.send("Le vote pour la lecture aléatoire a été adopté. Mélange de la liste de lecture.", delete_after=10) player.shuffle_votes.clear() random.shuffle(player.queue._queue) else: - await ctx.send(f'{ctx.author.mention} has voted to shuffle the playlist.', delete_after=15) + await ctx.send(f"{ctx.author.mention} a voté pour mélanger la liste de lecture.", delete_after=15) @commands.command(hidden=True) async def vol_up(self, ctx: commands.Context): @@ -664,7 +666,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin): if vol > 100: vol = 100 - await ctx.send('Maximum volume reached', delete_after=7) + await ctx.send("Le volume maximal est atteint.", delete_after=5) await player.set_volume(vol) @@ -680,20 +682,20 @@ class Music(commands.Cog, wavelink.WavelinkMixin): if vol < 0: vol = 0 - await ctx.send('Player is currently muted', delete_after=10) + await ctx.send("Le son est mute.", delete_after=7) await player.set_volume(vol) @commands.command(aliases=['eq']) async def equalizer(self, ctx: commands.Context, *, equalizer: str): - """Change the players equalizer.""" + """Change l'égaliseur de musique.\n ➡ Syntaxe: {PREFIX}equalizer/eq (flat/boost/metal/piano)""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: return if not self.is_privileged(ctx): - return await ctx.send('Only the DJ or admins may change the equalizer.') + return await ctx.send("Seul le DJ ou les admins peuvent modifier l'égaliseur.") eqs = {'flat': wavelink.Equalizer.flat(), 'boost': wavelink.Equalizer.boost(), @@ -703,22 +705,21 @@ class Music(commands.Cog, wavelink.WavelinkMixin): eq = eqs.get(equalizer.lower(), None) if not eq: - joined = "\n".join(eqs.keys()) - return await ctx.send(f'Invalid EQ provided. Valid EQs:\n\n{joined}') + return await ctx.send(f"EQ non valide fourni. EQs valides :\n\n{'\n'.join(eqs.keys())}") - await ctx.send(f'Successfully changed equalizer to {equalizer}', delete_after=15) + await ctx.send(f"Changement de l'égaliseur en {equalizer}.", delete_after=15) await player.set_eq(eq) @commands.command(aliases=['q', 'que']) async def queue(self, ctx: commands.Context): - """Display the players queued songs.""" + """Afficher les sons en attente.\n ➡ Syntaxe: {PREFIX}queue/que/q""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: return if player.queue.qsize() == 0: - return await ctx.send('There are no more songs in the queue.', delete_after=15) + return await ctx.send("Il n'y a plus de sons dans la file d'attente.", delete_after=15) entries = [track.title for track in player.queue._queue] pages = PaginatorSource(entries=entries) @@ -728,7 +729,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin): @commands.command(aliases=['np', 'now_playing', 'current']) async def nowplaying(self, ctx: commands.Context): - """Update the player controller.""" + """Met à jour l'embed qui affiche les informations sur la chanson en cours.\n ➡ Syntaxe: {PREFIX}nowplaying/now_playing/current/np""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: @@ -738,36 +739,36 @@ class Music(commands.Cog, wavelink.WavelinkMixin): @commands.command(aliases=['swap']) async def swap_dj(self, ctx: commands.Context, *, member: discord.Member = None): - """Swap the current DJ to another member in the voice channel.""" + """Change le DJ actuel à un autre membre dans le channel vocal.\n ➡ Syntaxe: {PREFIX}swap_dj/swap (membre)""" player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx) if not player.is_connected: return if not self.is_privileged(ctx): - return await ctx.send('Only admins and the DJ may use this command.', delete_after=15) + return await ctx.send("Seuls les admins et le DJ peuvent utiliser cette commande.", delete_after=15) members = self.bot.get_channel(int(player.channel_id)).members if member and member not in members: - return await ctx.send(f'{member} is not currently in voice, so can not be a DJ.', delete_after=15) + return await ctx.send(f"{member} n'est pas actuellement dans le salon, et ne peut donc pas être un DJ.", delete_after=15) if member and member == player.dj: - return await ctx.send('Cannot swap DJ to the current DJ... :)', delete_after=15) + return await ctx.send("Cette personne est déjà le DJ.", delete_after=15) if len(members) <= 2: - return await ctx.send('No more members to swap to.', delete_after=15) + return await ctx.send("Aucun autre membre à qui donner le rôle de DJ.", delete_after=15) if member: player.dj = member - return await ctx.send(f'{member.mention} is now the DJ.') + return await ctx.send(f"{member.mention} est maintenant le DJ.") for m in members: if m == player.dj or m.bot: continue else: player.dj = m - return await ctx.send(f'{member.mention} is now the DJ.') + return await ctx.send(f"{member.mention} est maintenant le DJ.") @commands.command(name='lyrics', aliases = ['l', 'lyric']) async def _lyrics(self, ctx, *, song: str = None):