add comments

This commit is contained in:
Mylloon 2021-08-17 11:35:25 +02:00
parent 1da3aac896
commit feed2b0c27
11 changed files with 76 additions and 4 deletions

View file

@ -5,6 +5,7 @@ from utils.core import userOrNick
from utils.time import timestampScreen
def setup(client):
"""Adding Cog to bot"""
client.add_cog(Citation(client))
class Citation(commands.Cog):
@ -14,6 +15,7 @@ class Citation(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message):
"""Triggered a message is received"""
urls = findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', message.content)
httpsString = "https://"
channelsString = "discord.com/channels/"

View file

@ -7,6 +7,7 @@ from utils.time import nowCustom, intToDatetime, nowUTC, timestampScreen
from cogs.internet import Internet
def setup(client):
"""Adding Cog to bot"""
client.add_cog(ConfrerieDuKassoulait(client))
class ConfrerieDuKassoulait(commands.Cog):
@ -16,6 +17,7 @@ class ConfrerieDuKassoulait(commands.Cog):
@commands.Cog.listener()
async def on_member_join(self, member):
"""Triggered when a member join a guild"""
if member.guild.id == 441208120644075520: # Confrérie du Kassoulait
if member.bot == True:
role = discord.utils.get(member.guild.roles, name = "Bot")
@ -45,12 +47,14 @@ class ConfrerieDuKassoulait(commands.Cog):
@commands.Cog.listener()
async def on_member_remove(self, member):
"""Triggered when a member leave a guild"""
if member.guild.id == 441208120644075520: # Confrérie du Kassoulait
channel = self.client.get_channel(741639570172674120) # salons des arrivées
await channel.send(f"{member.mention} ({member.name}) vient de quitter le serveur.")
@commands.Cog.listener()
async def on_message_delete(self, message):
"""Triggered when a message is deleted"""
try:
if message.author.guild.id == 441208120644075520: # Confrérie du Kassoulait
prefix = await self.client.get_prefix(message)
@ -84,6 +88,7 @@ class ConfrerieDuKassoulait(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message):
"""Triggered a message is received"""
if message.author.id == 869726667294248970 and message.author.bot: # Autopublish
await message.publish()

View file

@ -7,6 +7,7 @@ from utils.core import retirerDoublons, mentionToUser, isSlash, mySendHidden
from utils.time import intToDatetime
def setup(client):
"""Adding Cog to bot"""
client.add_cog(Fun(client))
class Fun(commands.Cog):
@ -44,6 +45,7 @@ class Fun(commands.Cog):
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.")
async def __iq(self, ctx, user = None):
"""Slash command"""
if user == None:
return await self._iq(ctx, True)
else:
@ -99,9 +101,11 @@ class Fun(commands.Cog):
await ctx.send(f"Erreur! Syntaxe : `{ctx.prefix}love <User1> [User2]`\n")
@_love.error
async def _love_error(self, ctx, error):
"""Error command handler"""
await ctx.send(str(error).replace('Member "', "Le membre **").replace('" not found', "** n'as pas été trouvé."))
@cog_ext.cog_slash(name="love", description = "Découvre la probabilité que ces deux personnes se mettent en couple.")
async def __love(self, ctx, user1: discord.Member, user2: discord.Member = None):
"""Slash command"""
if user2 != None:
return await self._love(ctx, user1, user2, True)
else:
@ -121,10 +125,12 @@ class Fun(commands.Cog):
return await ctx.send(f"{ctx.author.mention}, {choice(reponses)}")
@_8ball.error
async def _8ball_error(self, ctx, error):
"""Error command handler"""
if str(error) == "question is a required argument that is missing.":
await ctx.send(f"Mauvaise syntaxe : `{ctx.prefix}8ball/8b/8balls <question>`.")
@cog_ext.cog_slash(name="8ball", description = "Répond à ta question 🔮.")
async def __8ball(self, ctx, question):
"""Slash command"""
await self._8ball(ctx, True)
@commands.command(name='mock')
@ -190,6 +196,7 @@ class Fun(commands.Cog):
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):
"""Slash command"""
if n == None:
await self._random(ctx, True)
else:

View file

@ -6,6 +6,7 @@ from discord_slash import cog_ext
from utils.core import isSlash, mySendHidden
def setup(client):
"""Adding Cog to bot"""
client.add_cog(Games(client))
class Games(commands.Cog):
@ -48,10 +49,12 @@ class Games(commands.Cog):
await ctx.message.add_reaction(emoji = '')
return await ctx.send(embed = embed)
@_chifumi.error
async def _chifumi_error(self, ctx, error):
async def _chifumi_error(self, ctx, _):
"""Error command handler"""
await ctx.send(f"Mauvaise syntaxe : `{ctx.prefix}chifumi/shifumi/ppc <pierre/papier/ciseaux>`.")
@cog_ext.cog_slash(name="chifumi", description = "Un simple Chifumi contre le bot. <pierre/papier/ciseaux>")
async def __chifumi(self, ctx, choix):
"""Slash command"""
return await self._chifumi(ctx, choix, True)
@commands.command(name='plusoumoins', aliases = ['+ou-', '+-'])
@ -101,6 +104,7 @@ class Games(commands.Cog):
await ctx.send(f"T'as pas trouvé {ctx.author.mention}... dommage, c'était {number}.")
@cog_ext.cog_slash(name="plusoumoins", description = "Un plus ou moins entre 1 et 100.")
async def __plusoumoins(self, ctx):
"""Slash command"""
await self._plusoumoins(ctx, True)
@commands.command(name='pileouface', aliases=['pf'])
@ -113,4 +117,5 @@ class Games(commands.Cog):
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):
"""Slash command"""
await self._pileouface(ctx, True)

View file

@ -4,6 +4,7 @@ from discord_slash import cog_ext
from utils.core import isSlash, mySendHidden
def setup(client):
"""Adding Cog to bot"""
client.add_cog(Help(client))
class Help(commands.Cog):
@ -71,6 +72,7 @@ class Help(commands.Cog):
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):
"""Slash command"""
ctx.prefix = "/"
if cog == None:
return await self._help(ctx, True)
@ -88,4 +90,5 @@ class Help(commands.Cog):
return await ctx.send(embed = embed)
@cog_ext.cog_slash(name="invite", description = "Invite ce bot sur ton serveur !")
async def __invite(self, ctx):
"""Slash command"""
return await self._invite(ctx, True)

View file

@ -7,6 +7,7 @@ from discord_slash import cog_ext
from utils.core import randomImage, isSlash, mySendHidden, load
def setup(client):
"""Adding Cog to bot"""
client.add_cog(Internet(client))
class Internet(commands.Cog):
@ -68,6 +69,7 @@ class Internet(commands.Cog):
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):
"""Slash command"""
ctx.prefix = "/"
if subreddit == None:
return await self._memes(ctx, True)
@ -94,6 +96,7 @@ class Internet(commands.Cog):
return await message.add_reaction('❤️')
@cog_ext.cog_slash(name="cat", description = "Te montre un magnifique chat.")
async def __cat(self, ctx):
"""Slash command"""
return await self._cat(ctx, True)
@commands.command(name='dog', aliases = ['chien'])
@ -116,6 +119,7 @@ class Internet(commands.Cog):
return await message.add_reaction('❤️')
@cog_ext.cog_slash(name="dog", description = "Te montre un magnifique chien.")
async def __dog(self, ctx):
"""Slash command"""
return await self._dog(ctx, True)
@commands.command(name='sexe', aliases=['sexes', 'nude', 'nudes', 'nsfw'])
@ -135,6 +139,7 @@ class Internet(commands.Cog):
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):
"""Slash command"""
return await self._sexe(ctx, True)
@commands.command(name='news', aliases=['rss'])
@ -188,6 +193,7 @@ class Internet(commands.Cog):
await ctx.message.add_reaction(emoji = '')
@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"""
if source == None:
return await self._news(ctx, True)
else:

View file

@ -492,6 +492,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
return await addReaction(ctx.message, 0)
@cog_ext.cog_slash(name="connect", description = "Se connecte au salon vocal.")
async def _connect(self, ctx, channel = None):
"""Slash command"""
return await self.connect(ctx = ctx, channel = channel, fromSlash = True)
@commands.command(aliases=["p"])
@ -549,6 +550,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
return await addReaction(ctx.message, 0)
@cog_ext.cog_slash(name="play", description = "Joue ou met dans la file d'attente le son demandé.")
async def _play(self, ctx, son):
"""Slash command"""
return await self.play(ctx = ctx, query = son, fromSlash = True)
@commands.command()
@ -582,6 +584,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await mySendHidden(ctx, fromSlash, "Tu as voté pour mettre la musique en pause.", delete_after=15)
@cog_ext.cog_slash(name="pause", description = "Met en pause du son en cours.")
async def _pause(self, ctx):
"""Slash command"""
return await self.pause(ctx = ctx, fromSlash = True)
@commands.command()
@ -615,6 +618,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await mySendHidden(ctx, fromSlash, "Tu as voté pour relancer la musique.", delete_after=15)
@cog_ext.cog_slash(name="resume", description = "Reprend la musique en pause.")
async def _resume(self, ctx):
"""Slash command"""
return await self.resume(ctx = ctx, fromSlash = True)
@commands.command(aliases=["s"])
@ -648,6 +652,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await mySendHidden(ctx, fromSlash, f"Tu as voté pour passer le son ({len(player.skip_votes)}/{required}).", delete_after=15)
@cog_ext.cog_slash(name="skip", description = "Passe le son en cours.")
async def _skip(self, ctx):
"""Slash command"""
return await self.skip(ctx = ctx, fromSlash = True)
@commands.command(aliases=["disconnect", "dc"])
@ -678,6 +683,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await mySendHidden(ctx, fromSlash, "Tu as voté pour arrêter d'écouter de la musique.", delete_after=15)
@cog_ext.cog_slash(name="stop", description = "Stop le son en cours de lecture, supprime la file d'attente et quitte le vocal.")
async def _stop(self, ctx):
"""Slash command"""
return await self.stop(ctx = ctx, fromSlash = True)
@commands.command(aliases=['v', 'vol'])
@ -713,6 +719,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await ctx.send(f"Volume réglé sur **{vol}%** par {ctx.author.mention}", delete_after=7)
@cog_ext.cog_slash(name="volume", description = "Modifie le volume du bot.")
async def _volume(self, ctx, vol: int = None):
"""Slash command"""
return await self.volume(ctx = ctx, vol = vol, fromSlash = True)
@commands.command(aliases=['mix'])
@ -750,6 +757,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await mySendHidden(ctx, fromSlash, "Tu as voté pour mélanger la liste de lecture.", delete_after=15)
@cog_ext.cog_slash(name="shuffle", description = "Mélange les sons en file d'attente. (minimum 3 sons en file d'attente)")
async def _shuffle(self, ctx):
"""Slash command"""
return await self.shuffle(ctx = ctx, fromSlash = True)
@commands.command(hidden = True)
@ -818,6 +826,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
return await addReaction(ctx.message, 0)
@cog_ext.cog_slash(name="equalizer", description = "Change l'égaliseur de musique. (flat/boost/metal/piano)")
async def _equalizer(self, ctx, equalizer: str):
"""Slash command"""
return await self.equalizer(ctx = ctx, equalizer = equalizer, fromSlash = True)
@commands.command(aliases=['q', 'que'])
@ -847,6 +856,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await paginator.start(ctx)
@cog_ext.cog_slash(name="queue", description = "Affiche les sons en attente.")
async def _queue(self, ctx,):
"""Slash command"""
return await self.queue(ctx = ctx, fromSlash = True)
@commands.command(aliases=['np', 'now_playing', 'current'])
@ -867,6 +877,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
return await addReaction(ctx.message, 0)
@cog_ext.cog_slash(name="nowplaying", description = "Met à jour l'embed qui affiche les informations sur la chanson en cours si besoin.")
async def _nowplaying(self, ctx,):
"""Slash command"""
return await self.nowplaying(ctx = ctx, fromSlash = True)
@commands.command(aliases=['swap'])
@ -917,6 +928,7 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
return await ctx.send(f"{member.mention} est maintenant le DJ.")
@cog_ext.cog_slash(name="swap_dj", description = "Donne le rôle de DJ à un autre membre dans le salon vocal.")
async def _swap_dj(self, ctx, member: discord.Member = None):
"""Slash command"""
return await self.swap_dj(ctx = ctx, member = member, fromSlash = True)
@commands.command(name='lyrics', aliases = ['l', 'lyric'])
@ -985,10 +997,12 @@ class Music(commands.Cog, wavelink.WavelinkMixin):
await mySendHidden(ctx, fromSlash, f"Aucune musique demandé... `{ctx.prefix}lyrics/l/lyrics <song>`.")
@cog_ext.cog_slash(name="lyrics", description = "Affiche les paroles de la musique en cours, ou de la chanson spécifiée.")
async def __lyrics(self, ctx, song: str):
"""Slash command"""
return await self._lyrics(ctx = ctx, song = song, fromSlash = True)
@commands.command(name='lyricsromanized', aliases = ['lr', 'lyricromanized'], hidden = True)
async def _lyricsromanized(self, ctx, *, song: str = None):
"""Affiche les paroles de la musique en cours ou de la chanson spécifié mais rajouter un 'romanized' à la fin"""
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
if not song and player.is_playing:
song = re.sub(r"(\ )?\(.*\)", "", player.current.title)

View file

@ -6,6 +6,7 @@ from utils.core import getURLsInString, getMentionInString, isSlash, mySendHidde
from utils.time import stringTempsVersSecondes, nowUTC, intToDatetime, timedeltaToString
def setup(client):
"""Adding Cog to bot"""
client.add_cog(ReminderDiscord(client))
class ReminderDiscord(commands.Cog, name="Reminder"):
@ -68,6 +69,7 @@ class ReminderDiscord(commands.Cog, name="Reminder"):
Reminder().suppressionReminder(expired[5]) # suppression du rappel
@_reminderLoop.before_loop
async def __avant_reminderLoop(self):
"""Wait to start the loop until the whole bot is ready"""
await self.client.wait_until_ready()
@commands.command(name='reminder', aliases=["remind", "remindme", "rappel"])
@ -122,10 +124,12 @@ class ReminderDiscord(commands.Cog, name="Reminder"):
await mySendHidden(ctx, fromSlash, embed = embed)
@_reminder.error
async def _reminder_error(self, ctx, error):
"""Error command handler"""
if 'time is a required argument that is missing.' in str(error):
await ctx.send("Tu n'as pas spécifié de durée.")
@cog_ext.cog_slash(name="reminder", description = "Met en place un rappel.")
async def __reminder(self, ctx, time, reminder = None):
"""Slash command"""
if reminder == None:
return await self._reminder(ctx, time, True)
else:
@ -162,6 +166,7 @@ class ReminderDiscord(commands.Cog, name="Reminder"):
await message.add_reaction(emoji)
@cog_ext.cog_slash(name="reminderlist", description = "Affiche la liste des rappels d'un utilisateur.")
async def __reminderlist(self, ctx, userorpage = None):
"""Slash command"""
if userorpage == None:
return await self._reminderlist(ctx, True)
else:
@ -169,12 +174,14 @@ class ReminderDiscord(commands.Cog, name="Reminder"):
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload):
"""Triggered when a reaction is added"""
message, embed = await listReaction(self.client, payload)
if message:
await message.edit(embed = embed)
@commands.Cog.listener()
async def on_raw_reaction_remove(self, payload):
"""Triggered when a reaction is removed"""
message, embed = await listReaction(self.client, payload)
if message:
await message.edit(embed = embed)
@ -203,4 +210,5 @@ class ReminderDiscord(commands.Cog, name="Reminder"):
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):
"""Slash command"""
return await self._reminderdelete(ctx, id, True)

View file

@ -4,6 +4,7 @@ from discord_slash import cog_ext
from utils.core import isSlash, mySendHidden
def setup(client):
"""Adding Cog to bot"""
client.add_cog(School(client))
class School(commands.Cog):
@ -52,12 +53,14 @@ class School(commands.Cog):
await message.add_reaction(emoji = "")
@_appel.error
async def _appel_error(self, ctx, _):
"""Error command handler"""
# if isinstance(error, commands.CheckFailure):
# await ctx.send("Tu n'as pas la permission de faire cette commande, demande à un professeur.")
# else:
await ctx.send(f"Une erreur est survenue, syntaxe: `{ctx.prefix}appel [ID salon vocal]`.")
@cog_ext.cog_slash(name="appel", description = "Fais l'appel.")
async def __appel(self, ctx, voice_channel_id = None):
"""Slash command"""
ctx.prefix = "/"
if voice_channel_id == None:
return await self._appel(ctx, True)
@ -75,6 +78,3 @@ class School(commands.Cog):
if fromSlash != True:
await ctx.message.add_reaction(emoji = '')
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")
@cog_ext.cog_slash(name="getid", description = "Tuto vidéo sur comment récupérer l'ID d'un utilisateur/salon")
async def __getid(self, ctx):
return await self._getid(ctx, True)

View file

@ -9,6 +9,7 @@ from utils.core import mySendHidden, mentionToUser, getChangelogs, getActualVers
from utils.time import nowUTC, intToDatetime, timestampScreen, getAge, ageLayout, nowCustom
def setup(client):
"""Adding Cog to bot"""
client.add_cog(Utils(client))
class Utils(commands.Cog):
@ -19,6 +20,7 @@ class Utils(commands.Cog):
@commands.command(name='ping')
async def _ping(self, ctx, *arg):
"""Envoie une réponse avec les latences du Bot."""
arg, fromSlash, _ = isSlash(arg)
if arg == 'help':
@ -41,6 +43,7 @@ class Utils(commands.Cog):
await ctx.message.add_reaction(emoji = '')
@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"""
ctx.slash_created_at = nowCustom()
if arg == None:
return await self._ping(ctx, True)
@ -64,6 +67,7 @@ class Utils(commands.Cog):
await ctx.send(embed = embed)
@cog_ext.cog_slash(name="avatar", description = "Affiche ton avatar ou celui que tu mentionnes.")
async def __avatar(self, ctx, user = None):
"""Slash command"""
if user == None:
return await self._avatar(ctx, True)
else:
@ -114,9 +118,11 @@ class Utils(commands.Cog):
await ctx.send(embed = embed)
@_calc.error
async def _calc_error(self, ctx, _):
"""Error command handler"""
await ctx.send("Tu n'as pas spécifié de calcul.")
@cog_ext.cog_slash(name="calc", description = "Calculatrice.")
async def __calc(self, ctx, calcul):
"""Slash command"""
return await self._calc(ctx, calcul, True)
@commands.command(name='syntax')
@ -173,6 +179,7 @@ class Utils(commands.Cog):
await mySendHidden(ctx, fromSlash, syntaxe)
@cog_ext.cog_slash(name="syntax", description = "Informations pour bien éditer son texte.")
async def __syntax(self, ctx):
"""Slash command"""
return await self._syntax(ctx, True)
@commands.command(name='memo', aliases = ['note'])
@ -203,10 +210,12 @@ class Utils(commands.Cog):
return await mySendHidden(ctx, fromSlash, "Tu viens de recevoir ton mémo !", delete_after = 5)
@_memo.error
async def _memo_error(self, ctx, error):
"""Error command handler"""
if str(error) == "text is a required argument that is missing.":
await ctx.send(f"Vous devez renseigner un message : `{ctx.prefix}memo/note <message>`.")
@cog_ext.cog_slash(name="note", description = "T'envoie un petit memo par message privé.")
async def __memo(self, ctx, memo):
"""Slash command"""
return await self._memo(ctx, memo, True)
@commands.command(name='infos', aliases = ['info'])
@ -269,6 +278,7 @@ class Utils(commands.Cog):
await ctx.send(embed = embed)
@cog_ext.cog_slash(name="infos", description = "Donne des infos sur le bot.")
async def __infos(self, ctx):
"""Slash command"""
ctx.prefix = "/"
return await self._infos(ctx, True)
@ -326,6 +336,7 @@ class Utils(commands.Cog):
await ctx.message.add_reaction(emoji = '')
@cog_ext.cog_slash(name="amongus", description = "Affiche la carte voulue d'Among Us. Carte dispo : <mira/polus/skeld/airship>")
async def __amongus(self, ctx, map):
"""Slash command"""
ctx.prefix = "/"
return await self._amongus(ctx, map, True)
@ -359,6 +370,7 @@ class Utils(commands.Cog):
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.")
async def __whois(self, ctx, user: discord.Member = None):
"""Slash command"""
ctx.prefix = "/" # pas sûr que ce soit utile
if user == None:
return await self._whois(ctx, True)
@ -415,6 +427,7 @@ class Utils(commands.Cog):
prop5 = None, prop6 = None, prop7 = None, prop8 = None, prop9 = None, prop10 = None,
prop11 = None, prop12 = None, prop13 = None, prop14 = None, prop15 = None, prop16 = None,
prop17 = None, prop18 = None, prop19 = None, prop20 = None):
"""Slash command"""
ctx.prefix = "/"
args = [question, prop1, prop2, prop3, prop4, prop5, prop6, prop7, prop8,
prop9, prop10, prop11, prop12, prop13, prop14, prop15, prop16,
@ -452,6 +465,7 @@ class Utils(commands.Cog):
return await ctx.message.delete()
@cog_ext.cog_slash(name="avis", description = "Demande un avis, si 2 arguments, alors l'argument 1 est le titre, sinon c'est la demande.")
async def __avis(self, ctx, titreoudemande, demande = None):
"""Slash command"""
args = [titreoudemande, demande]
if args[1] == None:
args = args[:1]
@ -484,6 +498,7 @@ class Utils(commands.Cog):
await ctx.send(embed = embed)
@cog_ext.cog_slash(name="changelogs", description = "Affiche les changements de la dernière version ou d'une version précise.")
async def __changelogs(self, ctx, version = None):
"""Slash command"""
if version == None:
return await self._changelogs(ctx, True)
else:
@ -499,4 +514,5 @@ class Utils(commands.Cog):
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):
"""Slash command"""
return await self._minecraft(ctx, True)

View file

@ -28,24 +28,29 @@ print("Terminé !")
@client.event
async def on_connect():
"""Triggered when the bot is connected to Discord"""
print(f"Connecté !")
@client.event
async def on_disconnect():
"""Triggered when the bot is disconnected to Discord"""
print(f"Déconnecté.")
@client.event
async def on_resumed():
"""Triggered when the bot is reconnected to Discord"""
print(f"Reconnecté !")
@client.event
async def on_ready():
"""Triggered when the bot is ready to operate"""
await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = f"{customPrefix}help", type = discord.ActivityType.playing))
Reminder().creationTable()
print("Bot prêt.")
@client.event
async def on_command_error(ctx, error):
"""Triggered when a command enconter an error"""
if not ctx.invoked_with.startswith(customPrefix):
print(error)
if ctx.message:
@ -53,6 +58,7 @@ async def on_command_error(ctx, error):
@client.event
async def on_message(message):
"""Triggered a message is received"""
await client.process_commands(message)
if message.author == client.user: