Ajout d'un chronomètre
This commit is contained in:
		
							
								
								
									
										12
									
								
								bot.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								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 à <t:{int(fin.timestamp())}:T>)\nFin <t:{int(fin.timestamp())}:R>")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user