Fixed up a bunch of stuff for the last commit
parent
13dab13988
commit
564af6d548
9
bot.py
9
bot.py
|
@ -1,5 +1,6 @@
|
||||||
# db - msg_id, user_id, guild_id
|
# db - msg_id, user_id, guild_id
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import discord
|
import discord
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
@ -180,7 +181,6 @@ class ApplicationStartButtonView(discord.ui.View):
|
||||||
custom_id=f"persistent:start_application",
|
custom_id=f"persistent:start_application",
|
||||||
)
|
)
|
||||||
async def start_app(self, button: discord.ui.Button, interaction: discord.Interaction):
|
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()
|
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.")
|
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:
|
try:
|
||||||
await user.send(embed=embedd)
|
await user.send(embed=embedd)
|
||||||
except discord.Forbidden:
|
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
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(content="Application started", ephemeral=True)
|
await interaction.response.send_message(content="Application started", ephemeral=True)
|
||||||
|
@ -206,8 +206,9 @@ class ApplicationStartButtonView(discord.ui.View):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
application[f'question{i}'] = response.content
|
application[f'question{i}'] = response.content
|
||||||
except TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
user.send(content="As you haven't replied in 300 seconds, your application has been cancelled")
|
await user.send(content="As you haven't replied in 300 seconds, your application has been cancelled")
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open('applications.json', 'r') as f:
|
with open('applications.json', 'r') as f:
|
||||||
|
|
Loading…
Reference in New Issue