Ajout fonction mémo

This commit is contained in:
Mylloon 2020-12-04 09:29:07 +01:00
parent 76c066b8aa
commit f8bdbcde05

View file

@ -1,10 +1,8 @@
import discord
import discord, pytz, time, re
from discord.ext import commands
from random import randint, choice, shuffle
import time
from datetime import datetime
from pytz import timezone
import re
def setup(bot):
bot.add_cog(Commands(bot))
@ -325,3 +323,24 @@ class Commands(commands.Cog):
embed.set_author(name = f"Photo de profil de {user.name}")
embed.set_image(url = user.avatar_url)
await ctx.send(embed = embed)
@commands.command(name='memo', aliases = ['note'])
async def _memo(self, ctx, *, text):
"""T'envoie un petit memo par message privé.\n ➡ Syntaxe: .memo/note <message>"""
if len(text) <= 5:
await ctx.message.add_reaction(emoji = '')
return await ctx.send("Ta note doit au moins faire 5 caractères.")
elif len(text) >= 2048:
await ctx.message.add_reaction(emoji = '')
return await ctx.send("Ta note doit faire moins de 2048 caractères.")
else:
await ctx.message.delete()
embed = discord.Embed(description = text, color = randint(0, 0xFFFFFF))
embed.set_author(name = "Mémo", icon_url = ctx.author.avatar_url)
embed.set_footer(text = f'📝 le {datetime.now(pytz.timezone("Europe/Paris")).strftime("%d/%m/%Y à %H:%M:%S")}')
await ctx.author.send(embed = embed)
return await ctx.send("Tu viens de recevoir ton mémo !", delete_after = 5)
@_memo.error
async def _note_error(self, ctx, error):
if str(error) == "text is a required argument that is missing.":
await ctx.send("Vous devez renseigner un message : `.note/memo <message>`.")