Added Timeout message to application process
parent
9cd5e8efa4
commit
13dab13988
19
bot.py
19
bot.py
|
@ -197,14 +197,17 @@ class ApplicationStartButtonView(discord.ui.View):
|
|||
application = {'userId': interaction.user.id}
|
||||
|
||||
for i in range(1, max_questions+1):
|
||||
embed = discord.Embed(title=f'Question [{i}/{max_questions}]', description=questions[i])
|
||||
await user.send(embed=embed)
|
||||
response = await bot.wait_for('message', check=lambda m: m.author == interaction.user and m.channel == user, timeout=300)
|
||||
if response.content.startswith("cancel"):
|
||||
await user.send("Your application has been cancelled")
|
||||
return
|
||||
else:
|
||||
application[f'question{i}'] = response.content
|
||||
try:
|
||||
embed = discord.Embed(title=f'Question [{i}/{max_questions}]', description=questions[i])
|
||||
await user.send(embed=embed)
|
||||
response = await bot.wait_for('message', check=lambda m: m.author == interaction.user and m.channel == user, timeout=300)
|
||||
if response.content.startswith("cancel"):
|
||||
await user.send("Your application has been cancelled")
|
||||
return
|
||||
else:
|
||||
application[f'question{i}'] = response.content
|
||||
except TimeoutError:
|
||||
user.send(content="As you haven't replied in 300 seconds, your application has been cancelled")
|
||||
|
||||
try:
|
||||
with open('applications.json', 'r') as f:
|
||||
|
|
Loading…
Reference in New Issue