possibilité de ne pas mettre de message dans le reminder
This commit is contained in:
parent
a5c4ed0312
commit
39988aae70
1 changed files with 38 additions and 36 deletions
|
@ -486,42 +486,44 @@ class Utils(commands.Cog):
|
||||||
|
|
||||||
embed = discord.Embed(color = 0xC41B1B)
|
embed = discord.Embed(color = 0xC41B1B)
|
||||||
mention = False
|
mention = False
|
||||||
if reminder:
|
if not reminder:
|
||||||
if time.lower().endswith("@"):
|
reminder = "Notification"
|
||||||
time = time[:-1]
|
if time.lower().endswith("@"):
|
||||||
mention = True
|
time = time[:-1]
|
||||||
seconds = stringTempsVersSecondes(time)
|
mention = True
|
||||||
if seconds == 0:
|
seconds = stringTempsVersSecondes(time)
|
||||||
embed.add_field(name="Attention", value="Mauvais format pour le temps, `d` pour jour, `h` pour heure, `m` pour minute, `s` pour seconde (ne fonctionne qu'avec une seule unité)\nMet un `@` accolée à l'unité pour mentionner les gens mentionner dans ton message.")
|
if seconds == 0:
|
||||||
elif seconds > 7776000: # 90 * 60 * 60 * 24
|
embed.add_field(name="Attention", value="Mauvais format pour le temps, `d` pour jour, `h` pour heure, `m` pour minute, `s` pour seconde\nMet un `@` accolée à l'unité pour mentionner les gens mentionner dans ton message.")
|
||||||
embed.add_field(name="Attention", value="Tu as spécifié une durée trop longue, la durée maximum étant de 90 jours.")
|
elif seconds > 7776000: # 90 * 60 * 60 * 24
|
||||||
else:
|
embed.add_field(name="Attention", value="Tu as spécifié une durée trop longue, la durée maximum étant de 90 jours.")
|
||||||
await ctx.send(f"Ok, je t'en parles dans {time} !")
|
|
||||||
await asyncio.sleep(seconds)
|
|
||||||
message = ctx.author.mention
|
|
||||||
if mention:
|
|
||||||
mentionList = getMentionInString(reminder)
|
|
||||||
for i in mentionList:
|
|
||||||
message += f" {i}"
|
|
||||||
try:
|
|
||||||
if fromSlash != True:
|
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
finalEmbed = discord.Embed(description = cleanCodeStringWithMentionAndURLs(reminder), timestamp = datetime.utcnow(), color = discord.Colour.random())
|
|
||||||
finalEmbed.set_footer(text=f"Message d'il y a {time}")
|
|
||||||
|
|
||||||
links = ""
|
|
||||||
findedURLs = getURLsInString(reminder)
|
|
||||||
for i in range(0, len(findedURLs)):
|
|
||||||
links += f"[Lien {i + 1}]({findedURLs[i]}) · "
|
|
||||||
if len(findedURLs) > 0:
|
|
||||||
finalEmbed.add_field(name = f"Lien{'s' if len(findedURLs) > 1 else ''}", value = links[:-3])
|
|
||||||
|
|
||||||
return await ctx.send(message, embed = finalEmbed)
|
|
||||||
else:
|
else:
|
||||||
embed.add_field(name="Attention", value="Mauvaise syntaxe : reminder <temps> <message>")
|
await ctx.send(f"Ok, je t'en parles dans {time} !")
|
||||||
|
await asyncio.sleep(seconds)
|
||||||
|
message = ctx.author.mention
|
||||||
|
if mention:
|
||||||
|
mentionList = getMentionInString(reminder)
|
||||||
|
for i in mentionList:
|
||||||
|
message += f" {i}"
|
||||||
|
try:
|
||||||
|
if fromSlash != True:
|
||||||
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
finalEmbed = discord.Embed(description = cleanCodeStringWithMentionAndURLs(reminder), timestamp = datetime.utcnow(), color = discord.Colour.random())
|
||||||
|
finalEmbed.set_footer(text=f"Message d'il y a {time}")
|
||||||
|
|
||||||
|
links = ""
|
||||||
|
findedURLs = getURLsInString(reminder)
|
||||||
|
for i in range(0, len(findedURLs)):
|
||||||
|
links += f"[Lien {i + 1}]({findedURLs[i]}) · "
|
||||||
|
if len(findedURLs) > 0:
|
||||||
|
finalEmbed.add_field(name = f"Lien{'s' if len(findedURLs) > 1 else ''}", value = links[:-3])
|
||||||
|
|
||||||
|
return await ctx.send(message, embed = finalEmbed)
|
||||||
await ctx.send(embed = embed)
|
await ctx.send(embed = embed)
|
||||||
@cog_ext.cog_slash(name="reminder", description = "Met en place un rappel.")
|
@cog_ext.cog_slash(name="reminder", description = "Met en place un rappel.")
|
||||||
async def __reminder(self, ctx, time, reminder):
|
async def __reminder(self, ctx, time, reminder = None):
|
||||||
return await self._reminder(ctx, time, reminder, True)
|
if reminder == None:
|
||||||
|
return await self._reminder(ctx, time, True)
|
||||||
|
else:
|
||||||
|
return await self._reminder(ctx, time, reminder, True)
|
||||||
|
|
Reference in a new issue