From 2eb182b73db8c34d807c83088256cae1e764784b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 1 Jun 2021 21:18:02 +0200 Subject: [PATCH] fix random command with n < 1 --- src/cogs/fun.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cogs/fun.py b/src/cogs/fun.py index 5e95f04..9348b57 100644 --- a/src/cogs/fun.py +++ b/src/cogs/fun.py @@ -195,7 +195,10 @@ class Fun(commands.Cog): else: n = 10 - resultat = randint(1, n) + x = 1 + if x > n: + x, n = n, x + resultat = randint(x, n) if fromSlash != True: await ctx.message.add_reaction(emoji = '✅') return await ctx.send(embed = discord.Embed().set_author(name = f"Tu as tiré le chiffre {resultat} !"))