adding @ when mentioning the user

This commit is contained in:
Mylloon 2021-07-29 23:35:17 +02:00
parent d64e6f1539
commit d316cb0bc8
2 changed files with 13 additions and 13 deletions

View file

@ -21,11 +21,11 @@ class Commandes(commands.Cog):
if ctx.author.is_mod: if ctx.author.is_mod:
if CommandesDB().existeCommande(commandName)[0] == False: if CommandesDB().existeCommande(commandName)[0] == False:
CommandesDB().ajoutCommande(commandName, commandMessage) CommandesDB().ajoutCommande(commandName, commandMessage)
await ctx.send(f"{ctx.author.name}, commande {commandName} ajoutée !") await ctx.send(f"@{ctx.author.name}, commande {commandName} ajoutée !")
else: else:
await ctx.send(f"{ctx.author.name}, {self.alreadyExistingCommand}.") await ctx.send(f"@{ctx.author.name}, {self.alreadyExistingCommand}.")
else: else:
await ctx.send(f"{ctx.author.name}, {self.notModo}.") await ctx.send(f"@{ctx.author.name}, {self.notModo}.")
@commands.command(name="remove") @commands.command(name="remove")
async def _remove(self, ctx: commands.Context, commandName = None): async def _remove(self, ctx: commands.Context, commandName = None):
@ -35,11 +35,11 @@ class Commandes(commands.Cog):
if ctx.author.is_mod: if ctx.author.is_mod:
if CommandesDB().existeCommande(commandName)[0]: if CommandesDB().existeCommande(commandName)[0]:
CommandesDB().suppressionCommande(commandName) CommandesDB().suppressionCommande(commandName)
await ctx.send(f"{ctx.author.name}, commande {commandName} supprimée !") await ctx.send(f"@{ctx.author.name}, commande {commandName} supprimée !")
else: else:
await ctx.send(f"{ctx.author.name}, {self.notExistingCommand}.") await ctx.send(f"@{ctx.author.name}, {self.notExistingCommand}.")
else: else:
await ctx.send(f"{ctx.author.name}, {self.notModo}.") await ctx.send(f"@{ctx.author.name}, {self.notModo}.")
@commands.command(name="list") @commands.command(name="list")
async def _list(self, ctx: commands.Context): async def _list(self, ctx: commands.Context):
@ -52,12 +52,12 @@ class Commandes(commands.Cog):
commandes.append((command.name,)) commandes.append((command.name,))
if len(commandes) > 0: if len(commandes) > 0:
message = f"{ctx.author.name}, liste des commandes -> " message = f"@{ctx.author.name}, liste des commandes -> "
for commande in commandes: for commande in commandes:
message += f"{self.keys['PREFIX']}{commande[0]}, " message += f"{self.keys['PREFIX']}{commande[0]}, "
await ctx.send(message[:-2]) await ctx.send(message[:-2])
else: else:
await ctx.send(f"{ctx.author.name}, aucune commande enrengistrée dans la base de donnée.") await ctx.send(f"@{ctx.author.name}, aucune commande enrengistrée dans la base de donnée.")
@commands.command(name="edit") @commands.command(name="edit")
async def _edit(self, ctx: commands.Context, commandName = None, commandMessage = None): async def _edit(self, ctx: commands.Context, commandName = None, commandMessage = None):
@ -68,15 +68,15 @@ class Commandes(commands.Cog):
if CommandesDB().existeCommande(commandName)[0]: if CommandesDB().existeCommande(commandName)[0]:
CommandesDB().suppressionCommande(commandName) CommandesDB().suppressionCommande(commandName)
CommandesDB().ajoutCommande(commandName, commandMessage) CommandesDB().ajoutCommande(commandName, commandMessage)
await ctx.send(f"{ctx.author.name}, commande {commandName} modifiée !") await ctx.send(f"@{ctx.author.name}, commande {commandName} modifiée !")
else: else:
await ctx.send(f"{ctx.author.name}, {self.notExistingCommand}.") await ctx.send(f"@{ctx.author.name}, {self.notExistingCommand}.")
else: else:
await ctx.send(f"{ctx.author.name}, {self.notModo}.") await ctx.send(f"@{ctx.author.name}, {self.notModo}.")
@commands.Cog.event() @commands.Cog.event()
async def event_message(self, message): async def event_message(self, message):
if message.content.startswith(self.keys["PREFIX"]): if message.content.startswith(self.keys["PREFIX"]):
command = CommandesDB().existeCommande(message.content[1:].split(" ")[0]) # récupère le nom de la commande command = CommandesDB().existeCommande(message.content[1:].split(" ")[0]) # récupère le nom de la commande
if command[0]: # vérification si existe if command[0]: # vérification si existe
await message.channel.send(f"{message.author.name}, {command[1]}") # envois le contenu de la commande await message.channel.send(f"@{message.author.name}, {command[1]}") # envois le contenu de la commande

View file

@ -12,4 +12,4 @@ class Utils(commands.Cog):
@commands.command() @commands.command()
async def discord(self, ctx: commands.Context): async def discord(self, ctx: commands.Context):
"""Envoie le lien de ton serveur Discord""" """Envoie le lien de ton serveur Discord"""
await ctx.send(f"Rejoins mon Discord {self.keys['DISCORD']} !") await ctx.send(f"@{ctx.author.name}, Rejoins mon Discord {self.keys['DISCORD']} !")