Added Timeout message to application process
parent
9cd5e8efa4
commit
13dab13988
3
bot.py
3
bot.py
|
@ -197,6 +197,7 @@ class ApplicationStartButtonView(discord.ui.View):
|
||||||
application = {'userId': interaction.user.id}
|
application = {'userId': interaction.user.id}
|
||||||
|
|
||||||
for i in range(1, max_questions+1):
|
for i in range(1, max_questions+1):
|
||||||
|
try:
|
||||||
embed = discord.Embed(title=f'Question [{i}/{max_questions}]', description=questions[i])
|
embed = discord.Embed(title=f'Question [{i}/{max_questions}]', description=questions[i])
|
||||||
await user.send(embed=embed)
|
await user.send(embed=embed)
|
||||||
response = await bot.wait_for('message', check=lambda m: m.author == interaction.user and m.channel == user, timeout=300)
|
response = await bot.wait_for('message', check=lambda m: m.author == interaction.user and m.channel == user, timeout=300)
|
||||||
|
@ -205,6 +206,8 @@ class ApplicationStartButtonView(discord.ui.View):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
application[f'question{i}'] = response.content
|
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:
|
try:
|
||||||
with open('applications.json', 'r') as f:
|
with open('applications.json', 'r') as f:
|
||||||
|
|
Loading…
Reference in New Issue