Merge pull request #17 from Rom194/patch-6

Update sondage.py
This commit is contained in:
Maël 2018-12-20 18:12:37 -04:00 committed by GitHub
commit d85a5b8005
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: