✨ add choose problem command
This commit is contained in:
parent
ce3f517296
commit
3f3520aaf5
|
@ -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"
|
GUILD = "690934836696973404"
|
||||||
|
|
||||||
bot = commands.Bot("!")
|
bot = commands.Bot(
|
||||||
|
"!", help_command=commands.DefaultHelpCommand(no_category="Commandes")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
|
@ -54,14 +56,24 @@ async def choose(ctx: Context, *args):
|
||||||
await ctx.send(f"J'ai choisi... **{choice}**")
|
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
|
@bot.event
|
||||||
async def on_error(event, *args, **kwargs):
|
async def on_error(event, *args, **kwargs):
|
||||||
print(event)
|
print(event)
|
||||||
print(*args)
|
print(*args)
|
||||||
print(kwargs)
|
print(kwargs)
|
||||||
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
bot.run(TOKEN)
|
bot.run(TOKEN)
|
||||||
|
|
Loading…
Reference in New Issue