Ajout d'un chronomètre

This commit is contained in:
Emmy D'Anello 2025-03-11 22:42:29 +01:00
parent a3c71800af
commit 9eb13560f2
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

12
bot.py
View File

@ -2,6 +2,7 @@
from collections import namedtuple from collections import namedtuple
import copy import copy
from datetime import datetime, timedelta
from functools import partial from functools import partial
import json import json
from pathlib import Path from pathlib import Path
@ -382,9 +383,16 @@ async def melanger(ctx: commands.Context, nb_defis: int = 5):
await afficher_main(ctx, author_id=member_id) await afficher_main(ctx, author_id=member_id)
@bot.command()
async def de(ctx: commands.Context, nb_faces: int = 6): async def de(ctx: commands.Context, nb_faces: int = 6):
resultat = random.randint(1, nb_faces + 1) resultat = random.randint(1, nb_faces + 1)
await ctx.reply(f":dice: Résultat du dé à {nb_faces} faces : **{resultat}**") await ctx.reply(f":game_die: Résultat du dé à {nb_faces} faces : **{resultat}**")
@bot.command()
async def chronometre(ctx: commands.Context, minutes: int = 30, secondes: int = 0):
fin = datetime.now() + timedelta(minutes=minutes, seconds=secondes)
await ctx.send(f"Chronomètre lancé pour **{minutes:02d}:{secondes:02d}** (fin à <t:{int(fin.timestamp())}:T>)\nFin <t:{int(fin.timestamp())}:R>")
@bot.command() @bot.command()
@ -437,6 +445,8 @@ async def save(ctx: commands.Context):
@terminer.error @terminer.error
@echange.error @echange.error
@melanger.error @melanger.error
@de.error
@chronometre.error
@debug.error @debug.error
@reload.error @reload.error
@save.error @save.error