From 9eb13560f236ec114f8e481c9b67a7024eac71d8 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Tue, 11 Mar 2025 22:42:29 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20chronom=C3=A8tre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 82e94a3..5905c24 100755 --- a/bot.py +++ b/bot.py @@ -2,6 +2,7 @@ from collections import namedtuple import copy +from datetime import datetime, timedelta from functools import partial import json 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) +@bot.command() async def de(ctx: commands.Context, nb_faces: int = 6): 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 à )\nFin ") @bot.command() @@ -437,6 +445,8 @@ async def save(ctx: commands.Context): @terminer.error @echange.error @melanger.error +@de.error +@chronometre.error @debug.error @reload.error @save.error