mirror of
				https://gitlab.com/ddorn/tfjm-discord-bot.git
				synced 2025-11-04 03:42:12 +01:00 
			
		
		
		
	✨ add choose problem command
This commit is contained in:
		
							
								
								
									
										8
									
								
								problems
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								problems
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
1: Création de puzzles
 | 
			
		||||
2: Départ en vacances
 | 
			
		||||
3: Un festin stratégique
 | 
			
		||||
4: Sauver les meubles
 | 
			
		||||
5: Prêt à décoller ?
 | 
			
		||||
6: Ils nous espionnent !
 | 
			
		||||
7: De joyeux bûcherons
 | 
			
		||||
8: Robots auto-réplicateurs
 | 
			
		||||
@@ -21,7 +21,9 @@ if TOKEN is None:
 | 
			
		||||
 | 
			
		||||
GUILD = "690934836696973404"
 | 
			
		||||
 | 
			
		||||
bot = commands.Bot("!")
 | 
			
		||||
bot = commands.Bot(
 | 
			
		||||
    "!", help_command=commands.DefaultHelpCommand(no_category="Commandes")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@bot.event
 | 
			
		||||
@@ -54,14 +56,24 @@ async def choose(ctx: Context, *args):
 | 
			
		||||
    await ctx.send(f"J'ai choisi... **{choice}**")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@bot.command(
 | 
			
		||||
    name="random-problem",
 | 
			
		||||
    help="Choisit un problème parmi ceux de cette année.",
 | 
			
		||||
    aliases=["rp", "problème-aléatoire", "probleme-aleatoire", "pa"],
 | 
			
		||||
)
 | 
			
		||||
async def random_problem(ctx: Context):
 | 
			
		||||
    problems = open("problems").readlines()
 | 
			
		||||
    problems = [p.strip() for p in problems]
 | 
			
		||||
    problem = random.choice(problems)
 | 
			
		||||
    await ctx.send(f"Le problème tiré est... **{problem}**")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@bot.event
 | 
			
		||||
async def on_error(event, *args, **kwargs):
 | 
			
		||||
    print(event)
 | 
			
		||||
    print(*args)
 | 
			
		||||
    print(kwargs)
 | 
			
		||||
 | 
			
		||||
    raise
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    bot.run(TOKEN)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user