Added Timeout message to application process

main
Anorak_1 2023-08-01 22:42:18 +02:00
parent 9cd5e8efa4
commit 13dab13988
1 changed files with 11 additions and 8 deletions

19
bot.py
View File

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