Update sondage.py
optimisation
This commit is contained in:
parent
9018636869
commit
0e76bcd94c
1 changed files with 5 additions and 7 deletions
|
@ -19,16 +19,14 @@ class Sondage:
|
||||||
time = [x for x in options if x.startswith("time=")]
|
time = [x for x in options if x.startswith("time=")]
|
||||||
if time:
|
if time:
|
||||||
time = time[0]
|
time = time[0]
|
||||||
if time:
|
|
||||||
options.remove(time)
|
options.remove(time)
|
||||||
if len(options) <= 1:
|
|
||||||
raise commands.errors.MissingRequiredArgument
|
|
||||||
if len(options) >= 21:
|
|
||||||
return await ctx.send(ctx.message.author.mention + "> :octagonal_sign: Vous ne pouvez pas mettre plus de 20 réponses !")
|
|
||||||
if time:
|
|
||||||
time = int(time.strip("time="))
|
time = int(time.strip("time="))
|
||||||
else:
|
else:
|
||||||
time = 0
|
time = 0
|
||||||
|
if len(options) <= 1:
|
||||||
|
raise commands.errors.MissingRequiredArgument
|
||||||
|
if len(options) >= 21:
|
||||||
|
return await ctx.send(ctx.author.mention + "> :octagonal_sign: Vous ne pouvez pas mettre plus de 20 réponses !")
|
||||||
emoji = ['1⃣',
|
emoji = ['1⃣',
|
||||||
'2⃣',
|
'2⃣',
|
||||||
'3⃣',
|
'3⃣',
|
||||||
|
@ -56,7 +54,7 @@ class Sondage:
|
||||||
confirmation_msg += "{} - {}\n".format(emoji[idx], option)
|
confirmation_msg += "{} - {}\n".format(emoji[idx], option)
|
||||||
to_react.append(emoji[idx])
|
to_react.append(emoji[idx])
|
||||||
confirmation_msg += "*Sondage proposé par* " + \
|
confirmation_msg += "*Sondage proposé par* " + \
|
||||||
str(ctx.message.author.mention)
|
str(ctx.author.mention)
|
||||||
if time == 0:
|
if time == 0:
|
||||||
confirmation_msg += ""
|
confirmation_msg += ""
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue