From 564af6d548df05718febe1ff171aef3c91d30f97 Mon Sep 17 00:00:00 2001 From: Anorak_1 Date: Tue, 1 Aug 2023 23:52:03 +0200 Subject: [PATCH] Fixed up a bunch of stuff for the last commit --- bot.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 0b46270..d23af27 100644 --- a/bot.py +++ b/bot.py @@ -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: