You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
awaitctx.channel.send("Sorry, I couldn't understand your command. Please make sure the poll question is in quotes.")
326
-
return
327
-
328
-
# Get the TTL for the poll
329
-
user_input=user_input[count+1:]
330
-
ifnotuser_input:
331
-
awaitctx.channel.send("You didn't provide a time. Assuming 5 minutes.")
332
-
poll_time="5m"
333
-
else:
334
-
poll_time=""
310
+
try:
311
+
# Get the user's question
312
+
prompt=""
313
+
writing=False
335
314
count=0
336
315
forcharacterinuser_input:
337
316
count+=1
338
-
ifcharacter!=" ":
339
-
poll_time+=character
340
-
else:
341
-
break
342
-
343
-
unit_long=""
344
-
unit=poll_time[-1].lower()
345
-
poll_time=int(poll_time[:-1])
346
-
poll_time_in_sec=0
347
-
ifunit=='s':
348
-
unit_long="seconds"
349
-
poll_time_in_sec=poll_time
350
-
elifunit=='m':
351
-
unit_long="minutes"
352
-
poll_time_in_sec=poll_time*60
353
-
elifunit=='h':
354
-
unit_long="hours"
355
-
poll_time_in_sec=poll_time*3600
356
-
elifunit=='d':
357
-
unit_long="days"
358
-
poll_time_in_sec=poll_time*86400
359
-
360
-
361
-
# Get emoji options
362
-
user_input=user_input[count:]
363
-
user_input=user_input.split()
364
-
options= []
365
-
message_sent=awaitctx.message.channel.send(f"<@{user.id}> has started a poll:\n{prompt}\nVoting will last {poll_time}{unit_long}.")
366
-
foremojiinuser_input:
367
-
options+=emoji
368
-
awaitmessage_sent.add_reaction(emoji)
317
+
ifnotwritingandcharacter=="\"":
318
+
writing=True
319
+
elifwriting:
320
+
ifcharacter=="\"":
321
+
writing=False
322
+
break
323
+
else:
324
+
prompt+=character
325
+
elifcount==len(user_input) -1:
326
+
awaitctx.channel.send("Sorry, I couldn't understand your command. Please make sure the poll question is in quotes.")
327
+
return
328
+
329
+
# Get the TTL for the poll
330
+
user_input=user_input[count+1:]
331
+
ifnotuser_input:
332
+
awaitctx.channel.send("You didn't provide a time. Assuming 5 minutes.")
333
+
poll_time="5m"
334
+
else:
335
+
poll_time=""
336
+
count=0
337
+
forcharacterinuser_input:
338
+
count+=1
339
+
ifcharacter!=" ":
340
+
poll_time+=character
341
+
else:
342
+
break
343
+
344
+
unit_long=""
345
+
unit=poll_time[-1].lower()
346
+
poll_time=int(poll_time[:-1])
347
+
poll_time_in_sec=0
348
+
ifunit=='s':
349
+
unit_long="seconds"
350
+
poll_time_in_sec=poll_time
351
+
elifunit=='m':
352
+
unit_long="minutes"
353
+
poll_time_in_sec=poll_time*60
354
+
elifunit=='h':
355
+
unit_long="hours"
356
+
poll_time_in_sec=poll_time*3600
357
+
elifunit=='d':
358
+
unit_long="days"
359
+
poll_time_in_sec=poll_time*86400
360
+
361
+
362
+
# Get emoji options
363
+
user_input=user_input[count:]
364
+
user_input=user_input.split()
365
+
options= []
366
+
message_sent=awaitctx.message.channel.send(f"<@{user.id}> has started a poll:\n{prompt}\nVoting will last {poll_time}{unit_long}.")
367
+
foremojiinuser_input:
368
+
options+=emoji
369
+
awaitmessage_sent.add_reaction(emoji)
370
+
except:
371
+
awaitctx.message.channel.send(f"<@{user.id}>, something went wrong with your command. Please make sure to use proper syntax:\n!poll \"QUESTION\" TIME[S/M/H/D] EMOJI1 EMOJI2 ...")
0 commit comments