1313import economie as eco
1414
1515
16-
1716@bot .event
1817async def on_ready ():
1918 global command_enabled
@@ -49,7 +48,7 @@ async def helping_tools(interaction: discord.Interaction):
4948 best_lap = "Meilleur tour (uniquement pour Course et Sprint, optionnel pour Qualif)"
5049)
5150async def submit (interaction : discord .Interaction ,
52- statue : Literal ["Course" , "Qualif" , "Sprint" , "Sprint_Qualif" ],
51+ statue : Literal ["Course" , "Qualif" , "Sprint" , "Sprint_Qualif" ],
5352 premier : str ,
5453 deuxieme : str ,
5554 troisieme : str ,
@@ -88,7 +87,8 @@ async def submit(interaction: discord.Interaction,
8887
8988 if success :
9089 await interaction .followup .send ("✅ Ton prono a bien été pris en compte !" , ephemeral = True )
91- logger .info (f'{ interaction .user } a fait son pronostic { statue_lower } ' )
90+ logger .info (
91+ f'{ interaction .user } a fait son pronostic { statue_lower } ' )
9292 else :
9393 await embed .Error (interaction , "❌ Tu ne peux modifier ton pronostic qu'une seule fois." )
9494 else :
@@ -138,7 +138,8 @@ async def create(interaction: discord.Interaction, duration: float, statue: Lite
138138 await interaction .response .defer ()
139139 current_session = statue
140140 command_enabled = True
141- task = asyncio .create_task (tool .start_Session (interaction , duration ))
141+ task = asyncio .create_task (
142+ tool .start_Session (interaction , duration ))
142143 await task
143144 command_enabled = False
144145 current_session = None # reset à la fin de la session
@@ -357,7 +358,7 @@ async def reglement(interaction: discord.Interaction):
357358 await interaction .response .defer (ephemeral = True )
358359 await embed .rules (interaction )
359360 logger .info (f"{ interaction .user } a demandé les règles du BOT." )
360-
361+
361362# _______________________________________________________________________________________________________________________________
362363
363364
@@ -375,31 +376,32 @@ async def music(interaction: discord.Interaction, title: str):
375376@bot .tree .command (name = "next_event" , description = "Affiche le prochain événement F1" )
376377async def next_event (interaction : discord .Interaction ):
377378 await interaction .response .defer ()
378-
379+
379380 try :
380381 # Appelle ta fonction qui met à jour data/Session.json
381382 f1api .getNextEvent ()
382-
383+
383384 # Lecture du fichier JSON avec les infos du prochain event
384385 with open ('data/Session.json' , 'r' , encoding = 'utf-8' ) as f :
385386 session = json .load (f )
386-
387+
387388 embed = discord .Embed (title = "🏁 Prochain Événement F1" ,
388- description = f"Session: { session .get ('Session' )} \n "
389- f"Round: { session .get ('Round' )} \n "
390- f"Pays: { session .get ('Country' )} \n "
391- f"Circuit: { session .get ('Location' )} \n "
392- f"Saison: { session .get ('Saison' )} " ,
393- color = 0x0099ff )
394-
395- embed .add_field (name = "Date / Heure (UTC)" , value = session .get ('Date' ), inline = False )
389+ description = f"Session: { session .get ('Session' )} \n "
390+ f"Round: { session .get ('Round' )} \n "
391+ f"Pays: { session .get ('Country' )} \n "
392+ f"Circuit: { session .get ('Location' )} \n "
393+ f"Saison: { session .get ('Saison' )} " ,
394+ color = 0x0099ff )
395+
396+ embed .add_field (name = "Date / Heure (UTC)" ,
397+ value = session .get ('Date' ), inline = False )
396398 embed .set_footer (text = "Données via FastF1 API" )
397-
399+
398400 await interaction .followup .send (embed = embed )
399-
401+
400402 except Exception as e :
401403 await interaction .followup .send (f"❌ Une erreur est survenue : { e } " )
402-
404+
403405# _______________________________________________________________________________________________________________________________
404406
405407
@@ -412,10 +414,71 @@ async def paye(interaction: discord.Interaction):
412414
413415# _______________________________________________________________________________________________________________________________
414416
417+
415418@tree .command (name = "solde" , description = "Te permet de voir ton solde actuelle" )
416419async def solding (interaction : discord .Interaction ):
417420 await interaction .response .defer ()
418421 await eco .voir_solde (interaction )
419422 logger .info (f"{ interaction .user } a regardé son solde" )
420423
424+ # _______________________________________________________________________________________________________________________________
425+
426+
427+ @tree .command (name = "virement" , description = "Fais un virement de X argent sur le compte de la personnes que tu choisis." )
428+ @app_commands .describe (somme_a_retirer = "L'argent que tu veux envoyé à la personne" , member = "La personne que a qui tu veux envoyer de l'argent." )
429+ async def vir (interaction : discord .Interaction , somme_a_retirer : int , member : discord .Member ):
430+ await interaction .response .defer ()
431+ await eco .virement (interaction , somme_a_retirer , member )
432+ logger .info (f"{ interaction .user } a fais un virement à { member } " )
433+
434+ # _______________________________________________________________________________________________________________________________
435+
436+
437+ @tree .command (name = "admin_retrait" , description = "Fais un retrait de X argent sur le compte de la personnes que tu choisis." )
438+ @app_commands .describe (somme_a_retirer = "L'argent que tu veux retirer à la personne" , member = "La personne que a qui tu veux retirer de l'argent." )
439+ async def ret (interaction : discord .Interaction , somme_a_retirer : int , member : discord .Member ):
440+ if interaction .user .guild_permissions .administrator :
441+ await interaction .response .defer ()
442+ await eco .retrait (interaction , somme_a_retirer , member )
443+ logger .info (f"{ interaction .user } a fais un retrait à { member } " )
444+ else :
445+ await interaction .response .defer (ephemeral = True )
446+ await interaction .followup .send (embed = await embed .permError (interaction ), ephemeral = True )
447+
448+ # _______________________________________________________________________________________________________________________________
449+
450+
451+ @tree .command (name = "top" , description = "Montre les 10 plus grandes richesse du serveur" )
452+ async def toop (interaction : discord .Interaction ):
453+ await interaction .response .defer ()
454+ await eco .top (interaction )
455+ logger .info (f"{ interaction .user } à visionné le top 10 du serv" )
456+
457+ # _______________________________________________________________________________________________________________________________
458+
459+
460+ @tree .command (name = "deposit" , description = "Déplace ton argent de ton compte courant au compte bancaire sécurisé" )
461+ @app_commands .describe (somme_a_verser = "Argent que tu veux viré" )
462+ async def depo (interaction : discord .Interaction , somme_a_verser : int ):
463+ await interaction .response .defer ()
464+ await eco .virement_compte_courant_to_protect (interaction , somme_a_verser )
465+ logger .info (f"{ interaction .user } a verser **{ somme_a_verser } ** sur son compte sécurisé." )
466+
467+ # _______________________________________________________________________________________________________________________________
468+
469+ @tree .command (name = "solde_proteger" , description = "T'affiche ton solde sur ton compte protéger" )
470+ async def show (interaction : discord .Interaction ):
471+ await interaction .response .defer ()
472+ await eco .voir_solde_proteger (interaction )
473+ logger .info (f"{ interaction .user } a regardé son solde protegé" )
474+
475+ @tree .command (name = "withdraw" , description = "Déplace ton argent de ton compte protegé au compte courant" )
476+ @app_commands .describe (somme_a_verser = "Argent que tu veux viré" )
477+ async def dwith (interaction : discord .Interaction , somme_a_verser : int ):
478+ await interaction .response .defer ()
479+ await eco .virement_compte_protege_to_courant (interaction , somme_a_verser )
480+ logger .info (f"{ interaction .user } a verser **{ somme_a_verser } ** sur son compte courant." )
481+
482+
483+
421484bot .run (TOKEN )
0 commit comments