Fixed up a bunch of stuff for the last commit

main
Anorak_1 2023-08-01 23:52:03 +02:00
parent 13dab13988
commit 564af6d548
1 changed files with 5 additions and 4 deletions

9
bot.py
View File

@ -1,5 +1,6 @@
# db - msg_id, user_id, guild_id
import asyncio
import discord
import os
import json
@ -180,7 +181,6 @@ class ApplicationStartButtonView(discord.ui.View):
custom_id=f"persistent:start_application",
)
async def start_app(self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.send_message(content="Application started", ephemeral=True)
user = await interaction.user.create_dm()
embedd = discord.Embed(title=f'CreaTopia Application', description="Hey! Your application has started. You have 300 seconds to complete it.")
@ -189,7 +189,7 @@ class ApplicationStartButtonView(discord.ui.View):
try:
await user.send(embed=embedd)
except discord.Forbidden:
interaction.response.send_message(content="Can't start application. Please allow direct messages from server members in your privacy settings.", ephemeral=True)
await interaction.response.send_message(content="Can't start application. Please allow direct messages from server members in your privacy settings.", ephemeral=True)
return
await interaction.response.send_message(content="Application started", ephemeral=True)
@ -206,8 +206,9 @@ class ApplicationStartButtonView(discord.ui.View):
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")
except asyncio.TimeoutError:
await user.send(content="As you haven't replied in 300 seconds, your application has been cancelled")
return
try:
with open('applications.json', 'r') as f: