diff --git a/src/cogs/fun.py b/src/cogs/fun.py index daa3154..05c26c3 100644 --- a/src/cogs/fun.py +++ b/src/cogs/fun.py @@ -3,7 +3,7 @@ from re import findall from discord.ext import commands from random import randint, choice from discord_slash import cog_ext -from utils.core import retirerDoublons, mentionToUser, isSlash, mySendHidden +from utils.core import retirerDoublons, mentionToUser, isSlash, mySendHidden, addReaction from utils.time import intToDatetime def setup(client): @@ -23,7 +23,7 @@ class Fun(commands.Cog): if len(user) == 0: user = ctx.author if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(f"T'as {randint(randint(-100, 0), 220)} de QI {user.mention} !") else: user = user[0] @@ -31,16 +31,16 @@ class Fun(commands.Cog): user2 = self.client.get_user(mentionToUser(user)) if user2.id == self.client.user.id: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(f"Bah euh... j'ai que (au moins) 100 000 de QI :/") else: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) message = await ctx.send("...") return await message.edit(content = f"{user2.mention} a {randint(randint(-100,0),220)} de QI !") except: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) message = await ctx.send("...") return await message.edit(content = f"{user} a {randint(randint(-100, 0), 220)} de QI !") @cog_ext.cog_slash(name="iq", description = "Calcule ton QI.") @@ -66,7 +66,7 @@ class Fun(commands.Cog): UneDemande = True if users[0] == users[1]: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await mySendHidden(ctx, fromSlash, "Je suis sûr que cette personne s'aime ! :angry:") if users[0].nick: user1 = list(users[0].nick) @@ -90,14 +90,14 @@ class Fun(commands.Cog): coef_amour = 100 if UneDemande == True: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(f"Tu as {coef_amour}% de chance de te mettre en couple avec {''.join(user1)}") if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await ctx.send(f"{''.join(user1)} et {''.join(user2)} ont {coef_amour}% de chance de se mettre en couple !") else: if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') + await addReaction(ctx.message, 2) await ctx.send(f"Erreur! Syntaxe : `{ctx.prefix}love [User2]`\n") @_love.error async def _love_error(self, ctx, error): @@ -121,7 +121,7 @@ class Fun(commands.Cog): "je ferais mieux de pas te le dire maintenant...","je ne peux pas le prédire actuellement :/","concentre-toi et redemande.","n'y comptes pas trop.","ma réponse est non.", "mes sources disent que non.", "les perspectives ne sont pas si bonnes...","c'est très douteux."] if fromSlash != True: - if fromSlash != True: await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(f"{ctx.author.mention}, {choice(reponses)}") @_8ball.error async def _8ball_error(self, ctx, error): @@ -192,7 +192,7 @@ class Fun(commands.Cog): x, n = n, x resultat = randint(x, n) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(embed = discord.Embed().set_author(name = f"Tu as tiré le chiffre {resultat} !")) @cog_ext.cog_slash(name="random", description = "Tire au hasard un chiffre entre 1 et n (par défaut n=10)") async def __random(self, ctx, n: int = None): diff --git a/src/cogs/games.py b/src/cogs/games.py index 0aab9e7..9147fcf 100644 --- a/src/cogs/games.py +++ b/src/cogs/games.py @@ -3,7 +3,7 @@ import asyncio from discord.ext import commands from random import randint, choice from discord_slash import cog_ext -from utils.core import isSlash, mySendHidden +from utils.core import isSlash, mySendHidden, addReaction def setup(client): """Adding Cog to bot""" @@ -46,7 +46,7 @@ class Games(commands.Cog): embed = discord.Embed(title = f"{choix_jeu[choix][-1:]}VS {choix_jeu[ordi][-1:]}", description = description) embed.set_author(name = ctx.author.name, icon_url = ctx.author.avatar_url) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(embed = embed) @_chifumi.error async def _chifumi_error(self, ctx, _): @@ -113,7 +113,7 @@ class Games(commands.Cog): if fromSlash != True: fromSlash = False if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(f"{'Pile' if randint(0, 1) == 1 else 'Face'} !") @cog_ext.cog_slash(name="pileouface", description = "Pile ou face.") async def __pileouface(self, ctx): diff --git a/src/cogs/help.py b/src/cogs/help.py index f617467..53570f7 100644 --- a/src/cogs/help.py +++ b/src/cogs/help.py @@ -1,7 +1,7 @@ import discord from discord.ext import commands from discord_slash import cog_ext -from utils.core import isSlash, mySendHidden +from utils.core import isSlash, mySendHidden, addReaction def setup(client): """Adding Cog to bot""" @@ -20,8 +20,8 @@ class Help(commands.Cog): erreur = False if not cog: # Liste des Cog - halp = discord.Embed(title = 'Liste des catégories et commandes sans catégorie', - description = f'Utilisez `{ctx.prefix}help [catégorie]` pour en savoir plus sur elles et leur commande.', + halp = discord.Embed(title = "Liste des catégories et commandes sans catégorie", + description = f"Utilisez `{ctx.prefix}help [catégorie]` pour en savoir plus sur elles et leur commande.", color = discord.Colour.random()) for name_cog in self.client.cogs: liste_cmds = "" @@ -31,21 +31,21 @@ class Help(commands.Cog): liste_cmds += f", `{ctx.prefix}{cmds.name}`" nb_cmds += 1 if name_cog != "Help" and nb_cmds > 0: - halp.add_field(name = f'**{name_cog} ({nb_cmds}) — {self.client.cogs[name_cog].__doc__}**', value = liste_cmds[2:], inline = False) + halp.add_field(name = f"**{name_cog} ({nb_cmds}) — {self.client.cogs[name_cog].__doc__}**", value = liste_cmds[2:], inline = False) cmds_desc = '' for y in self.client.walk_commands(): if not y.cog_name and not y.hidden: - cmds_desc += (f'{ctx.prefix}{y.name} - {y.help}\n ⁢⁢⁢⁢⁢ ') + cmds_desc += (f"{ctx.prefix}{y.name} - {y.help}\n") if len(cmds_desc) > 1: - halp.add_field(name = 'Commandes sans catégorie', value = cmds_desc[0:len(cmds_desc)-1], inline = False) + halp.add_field(name = "Commandes sans catégorie", value = cmds_desc[0:len(cmds_desc)-1], inline = False) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await ctx.send(embed = halp) else: # Avertissement si il y a trop d'arguments dans la variable cog if len(cog) > 1: - await ctx.message.add_reaction(emoji = '❌') - halp = discord.Embed(title = 'Erreur !', description = "Tu as renseigné trop d'arguments !", color = 0xC41B1B) + await addReaction(ctx.message, 2) + halp = discord.Embed(title = "Erreur !", description = "Tu as renseigné trop d'arguments !", color = 0xC41B1B) await ctx.send(embed = halp) else: # Liste des commandes avec cogs. cog = [item.capitalize() for item in cog] @@ -53,7 +53,7 @@ class Help(commands.Cog): for x in self.client.cogs: for y in cog: if x == y: - halp = discord.Embed(title = f'{cog[0]} - Liste des commandes', description = self.client.cogs[cog[0]].__doc__, color = discord.Colour.random()) + halp = discord.Embed(title = f"{cog[0]} - Liste des commandes", description = self.client.cogs[cog[0]].__doc__, color = discord.Colour.random()) for c in self.client.get_cog(y).get_commands(): if not c.hidden: cmds_help = str(c.help).replace("{PREFIX}", ctx.prefix).split("\n") @@ -63,12 +63,12 @@ class Help(commands.Cog): found = True if not found: # Rappel si le cog n'existe pas. if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') - halp = discord.Embed(title = 'Erreur !', description = f"Qu'est ce que {cog[0]} ?", color = 0xC41B1B) + await addReaction(ctx.message, 2) + halp = discord.Embed(title = "Erreur !", description = f"Qu'est ce que {cog[0]} ?", color = 0xC41B1B) erreur = True else: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await mySendHidden(ctx, erreur, embed = halp) @cog_ext.cog_slash(name="help", description = "Affiche toutes les commandes du bot.") async def __help(self, ctx, cog = None): @@ -79,14 +79,14 @@ class Help(commands.Cog): else: return await self._help(ctx, cog, True) - @commands.command(name='invite') + @commands.command(name="invite") async def _invite(self, ctx, fromSlash = None): """Invite ce bot sur ton serveur !""" if fromSlash != True: fromSlash = False embed = discord.Embed(description = f"[Lien vers l'invitation Discord](https://discord.com/api/oauth2/authorize?client_id={self.client.user.id}&permissions=8&scope=bot%20applications.commands)").set_author(name="Invite moi !") if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(embed = embed) @cog_ext.cog_slash(name="invite", description = "Invite ce bot sur ton serveur !") async def __invite(self, ctx): diff --git a/src/cogs/internet.py b/src/cogs/internet.py index c22a1b9..d44f6a7 100644 --- a/src/cogs/internet.py +++ b/src/cogs/internet.py @@ -4,7 +4,7 @@ from discord.ext import commands from random import choice from asyncpraw import Reddit from discord_slash import cog_ext -from utils.core import randomImage, isSlash, mySendHidden, load +from utils.core import randomImage, isSlash, mySendHidden, load, addReaction def setup(client): """Adding Cog to bot""" @@ -57,7 +57,7 @@ class Internet(commands.Cog): else: message = await ctx.send(f"`{subredditchoix.capitalize()} pour {ctx.author.name}`\n{submission.url}") if fromSlash != True and fromSlash != None: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) if fromSlash != None: for emoji in ['🔺', '🔻']: await message.add_reaction(emoji) @@ -65,7 +65,7 @@ class Internet(commands.Cog): except Exception as error: print(f"Error in _memes command = args: {args}, subreddit: {subredditchoix}, error: {error}") if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') + await addReaction(ctx.message, 2) return await mySendHidden(ctx, fromSlash, f"Ce subreddit est interdit, mis en quarantaine ou n'existe pas. ({subredditchoix})") @cog_ext.cog_slash(name="meme", description = "Envoie un meme de reddit.") async def __memes(self, ctx, subreddit = None): @@ -91,7 +91,7 @@ class Internet(commands.Cog): embed.set_image(url = cat[0]['file']) embed.set_footer(text = f"random.cat a pris {cat[1]} ms.") if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) message = await ctx.send(embed=embed) return await message.add_reaction('❤️') @cog_ext.cog_slash(name="cat", description = "Te montre un magnifique chat.") @@ -114,7 +114,7 @@ class Internet(commands.Cog): embed.set_image(url = dog[0]['message']) embed.set_footer(text = f"dog.ceo a pris {dog[1]} ms.") if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) message = await ctx.send(embed=embed) return await message.add_reaction('❤️') @cog_ext.cog_slash(name="dog", description = "Te montre un magnifique chien.") @@ -129,13 +129,13 @@ class Internet(commands.Cog): fromSlash = False if ctx.channel.is_nsfw(): if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) else: ctx.prefix = "/" return await self._memes(ctx, "nsfw", None) else: if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') + await addReaction(ctx.message, 2) await mySendHidden(ctx, fromSlash, f"Désolé mais je n'envois ce genre de message seulement dans les salons NSFW !") @cog_ext.cog_slash(name="sexe", description = "Envois une image coquine. (NSFW)") async def __sexe(self, ctx): @@ -190,7 +190,7 @@ class Internet(commands.Cog): embed.set_footer(text = f"News de {choix_site.capitalize()}") await ctx.send(embed = embed) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) @cog_ext.cog_slash(name="news", description = "Info random dans le domaine de l'informatique, met commme arg liste pour la liste des sources dispo.") async def __news(self, ctx, source = None): """Slash command""" diff --git a/src/cogs/reminder.py b/src/cogs/reminder.py index 95056c0..2ffd0e3 100644 --- a/src/cogs/reminder.py +++ b/src/cogs/reminder.py @@ -2,7 +2,8 @@ import discord from discord.ext import commands, tasks from discord_slash import cog_ext from utils.reminder import Reminder, embedListe, listReaction -from utils.core import getURLsInString, getMentionInString, isSlash, mySendHidden, mentionToUser, cleanCodeStringWithMentionAndURLs +from utils.core import getURLsInString, getMentionInString, isSlash, mySendHidden +from utils.core import addReaction, mentionToUser, cleanCodeStringWithMentionAndURLs from utils.time import stringTempsVersSecondes, nowUTC, intToDatetime, timedeltaToString def setup(client): @@ -47,7 +48,7 @@ class ReminderDiscord(commands.Cog, name="Reminder"): except: sourceMessage = None # message a été supprimé if sourceMessage != None: - await sourceMessage.add_reaction(emoji = '✅') # ajout réaction + await addReaction(sourceMessage.message, 0) # ajout réaction finalEmbed.set_footer(text=f"Message d'il y a {timedeltaToString(int(nowUTC()) - expired[3])}") links = "" findedURLs = getURLsInString(reminder) @@ -101,7 +102,7 @@ class ReminderDiscord(commands.Cog, name="Reminder"): seconds = stringTempsVersSecondes(time) if type(seconds) != int: if fromSlash != True: - await ctx.message.add_reaction(emoji = '❓') + await addReaction(ctx.message, 1) return await mySendHidden(ctx, fromSlash, seconds) if seconds == 0: embed.add_field(name="Informations", value= @@ -119,7 +120,7 @@ class ReminderDiscord(commands.Cog, name="Reminder"): messageID = ctx.message.id reminderID = Reminder().ajoutReminder(messageID, ctx.channel.id, extrarg, reminder, now, now + seconds, ctx.author.id, guildID) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await mySendHidden(ctx, fromSlash, f"Reminder **`#{reminderID[0][0]}`** enrengistré ! Notification {destination} dans {timedeltaToString(seconds)}{'' if seconds >= 3600 else ' (avec 1m de retard maximum)'}.") await mySendHidden(ctx, fromSlash, embed = embed) @_reminder.error @@ -155,7 +156,7 @@ class ReminderDiscord(commands.Cog, name="Reminder"): return await mySendHidden(ctx, fromSlash, "Veuillez renseigné un utilisateur ou un numéro de page valide.") if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) embed, pageMAX, refresh = await embedListe(utilisateur, ctx.guild.id, page) message = await ctx.send(embed = embed) @@ -202,11 +203,11 @@ class ReminderDiscord(commands.Cog, name="Reminder"): if verification: Reminder().suppressionReminder(id) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await mySendHidden(ctx, fromSlash, f"Reminder **#{id}** supprimé !") else: if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') + await addReaction(ctx.message, 2) return await mySendHidden(ctx, fromSlash, "Rappel non trouvé, pas sur le bon serveur ou qui ne vous appartiens pas.") @cog_ext.cog_slash(name="reminderdelete", description = "Suppprime un rappel.") async def __reminderdelete(self, ctx, id): diff --git a/src/cogs/school.py b/src/cogs/school.py index 14108e4..0b5493b 100644 --- a/src/cogs/school.py +++ b/src/cogs/school.py @@ -1,7 +1,7 @@ import discord from discord.ext import commands from discord_slash import cog_ext -from utils.core import isSlash, mySendHidden +from utils.core import isSlash, mySendHidden, addReaction def setup(client): """Adding Cog to bot""" @@ -21,7 +21,7 @@ class School(commands.Cog): voice_channels = [] voice_channels.extend(ctx.guild.voice_channels) if fromSlash != True: - await ctx.message.add_reaction(emoji = "✅") + await addReaction(ctx.message, 0) limite_voice_channels = 7 if len(voice_channels) > limite_voice_channels and not voice_channel: return await mySendHidden(ctx, fromSlash, f"""Désolé mais il y a plus de {limite_voice_channels} salons vocaux sur ce serveur, utilisez plutôt `{ctx.prefix}appel {{ID salon vocal}}`. @@ -76,5 +76,5 @@ class School(commands.Cog): if fromSlash != True: fromSlash = False if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await mySendHidden(ctx, fromSlash, "Explication sur comment récuperer l'ID d'un utilisateur/salon : https://cdn.discordapp.com/attachments/640312926892195842/780802253258358834/GetID.mp4") diff --git a/src/cogs/utils.py b/src/cogs/utils.py index e1b9236..3d57b1e 100644 --- a/src/cogs/utils.py +++ b/src/cogs/utils.py @@ -5,7 +5,7 @@ from re import findall from sys import version as pyVersion from discord_slash import cog_ext from utils.core import map_list_among_us, cleanCodeStringWithMentionAndURLs, cleanUser, userOrNick, getLavalinkVersion -from utils.core import mySendHidden, mentionToUser, getChangelogs, getActualVersion, isSlash, load, devOrStableChannel +from utils.core import mySendHidden, mentionToUser, getChangelogs, getActualVersion, isSlash, load, devOrStableChannel, addReaction from utils.time import nowUTC, intToDatetime, timestampScreen, getAge, ageLayout, nowCustom def setup(client): @@ -40,7 +40,7 @@ class Utils(commands.Cog): ping2 = int(round(nowCustom() * 1000)) - now await message.edit(embed = discord.Embed(color = discord.Colour.random(), description = f':hourglass: {round(self.client.latency * 1000)} ms\n\n:heartbeat: {ping} ms\n\n:stopwatch: {ping2} ms')) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) @cog_ext.cog_slash(name="ping", description = "Affiche mon ping, mettre 'help' en argument pour connaître à quoi correspond les données.") async def __ping(self, ctx, arg = None): """Slash command""" @@ -60,7 +60,7 @@ class Utils(commands.Cog): else: user = self.client.get_user(mentionToUser(user)) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) embed = discord.Embed(description = f"[lien vers la photo de profil]({user.avatar_url}) de {user.mention}", color = discord.Colour.random()) embed.set_author(name = f"Photo de profil de {user.name}") embed.set_image(url = user.avatar_url) @@ -114,7 +114,7 @@ class Utils(commands.Cog): embed.add_field(name = 'Calcul :', value = equation, inline = False) embed.add_field(name = 'Réponse :', value = answer.replace('False', 'Faux').replace('True', 'Vrai'), inline = False) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await ctx.send(embed = embed) @_calc.error async def _calc_error(self, ctx, _): @@ -173,7 +173,7 @@ class Utils(commands.Cog): syntaxe += ">>> cette ligne est cité\ncelle là aussi (et elles le seront toutes!)\n" try: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) except: pass await mySendHidden(ctx, fromSlash, syntaxe) @@ -193,11 +193,11 @@ class Utils(commands.Cog): if len(text) <= 5: if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') + await addReaction(ctx.message, 2) return await mySendHidden(ctx, fromSlash, "Ta note doit au moins faire 5 caractères.") elif len(text) >= 2048: if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') + await addReaction(ctx.message, 2) return await ctx.send(ctx, fromSlash, "Ta note doit faire moins de 2048 caractères.") else: if fromSlash != True: @@ -272,7 +272,7 @@ class Utils(commands.Cog): embed.set_footer(text = f"Basé sur discord.py {discord.__version__}{lavalink}{python}") try: if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) except: pass await ctx.send(embed = embed) @@ -296,28 +296,28 @@ class Utils(commands.Cog): embed = discord.Embed(title = f"Map Mira HQ d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})") embed.set_image(url = image) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await ctx.send(embed = embed) elif map.lower() in map_list_among_us("polus"): image = "https://i.imgur.com/mhFmcw3.jpg" embed = discord.Embed(title = f"Map Polus d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})") embed.set_image(url = image) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await ctx.send(embed = embed) elif map.lower() in map_list_among_us("skeld"): image = "https://i.imgur.com/OSXI4Zv.jpg" embed = discord.Embed(title = f"Map The Skeld d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})") embed.set_image(url = image) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await ctx.send(embed = embed) elif map.lower() in map_list_among_us("airship"): image = "https://i.imgur.com/cm8Wogw.png" embed = discord.Embed(title = f"Map Airship d'Among Us", color = discord.Colour.random(), description = f"[lien de l'image]({image})") embed.set_image(url = image) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) await ctx.send(embed = embed) else: await mySendHidden(ctx, fromSlash, f"`{ctx.prefix}amongus `") @@ -333,7 +333,7 @@ class Utils(commands.Cog): else: await ctx.invoke(self.client.get_command("amongus")) else: - await ctx.message.add_reaction(emoji = '❓') + await addReaction(ctx.message, 1) @cog_ext.cog_slash(name="amongus", description = "Affiche la carte voulue d'Among Us. Carte dispo : ") async def __amongus(self, ctx, map): """Slash command""" @@ -365,7 +365,7 @@ class Utils(commands.Cog): embed.add_field(name = "Est sur le serveur depuis", value = ageLayout(getAge(user[0].joined_at))) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send(embed = embed) return await ctx.send(f"Tu mentionnes trop d'utilisateurs : `{ctx.prefix}whois [@membre]`") @cog_ext.cog_slash(name="whois", description = "Affiche les infos sur l'utilisateur.") @@ -417,7 +417,7 @@ class Utils(commands.Cog): for i in range(len(args[1:])): await sondage.add_reaction(emoji = emojis_chosen[i]) if fromSlash != True: - return await ctx.message.add_reaction(emoji = '✅') + return await addReaction(ctx.message, 0) else: return await ctx.send(f"Désolé, mais tu as mis trop de possibilités (maximum : 20)") else: @@ -480,7 +480,7 @@ class Utils(commands.Cog): changes = getChangelogs(version.replace(',', '.')) if changes[0] != 200: if fromSlash != True: - await ctx.message.add_reaction(emoji = '❌') + await addReaction(ctx.message, 2) if changes[0] == 404: message = "Veuillez renseigner un numéro de version valide et existant. Peut-être que vous utilisez une version de développement." elif changes[0] == 429: @@ -489,7 +489,7 @@ class Utils(commands.Cog): message = f"Erreur API inconnue ({changes[0]})." return await mySendHidden(ctx, fromSlash, message) if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) changements = changes[3].replace("## ", "◦ ").replace("# ", "• ") if len(changements) > 2048: changements = f"{changements[:1900]}..." @@ -510,7 +510,7 @@ class Utils(commands.Cog): if fromSlash != True: fromSlash = False if fromSlash != True: - await ctx.message.add_reaction(emoji = '✅') + await addReaction(ctx.message, 0) return await ctx.send("https://imgr.search.brave.com/5-k6Lgh0OyRI8IVwhiBrNRmlY94utGxSX0k9tvtpqiA/fit/590/150/no/1/aHR0cDovL2kuaW1n/dXIuY29tL3Azd2lz/OVAucG5n") @cog_ext.cog_slash(name="minecraft", description = "Affiche le code couleur utilisé dans Minecraft.") async def __minecraft(self, ctx): diff --git a/src/main.py b/src/main.py index 48b0576..2943097 100644 --- a/src/main.py +++ b/src/main.py @@ -5,7 +5,7 @@ from os import listdir, rename, getcwd from discord_slash import SlashCommand from discord.ext import commands from utils.reminder import Reminder -from utils.core import load +from utils.core import load, addReaction keys = load(["PREFIX", "TOKEN_DISCORD", "DEACTIVATE"]) customPrefix = keys["PREFIX"] @@ -54,7 +54,7 @@ async def on_command_error(ctx, error): if not ctx.invoked_with.startswith(customPrefix): print(error) if ctx.message: - await ctx.message.add_reaction(emoji = '❓') + await addReaction(ctx.message, 1) @client.event async def on_message(message):