Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -39,23 +39,23 @@ class MyClient(discord.Client):
|
|
39 |
logging.info("Web.py server has been started.")
|
40 |
|
41 |
async def on_message(self, message):
|
42 |
-
logging.debug(f"
|
43 |
if message.author == self.user:
|
44 |
-
logging.debug("
|
45 |
return
|
46 |
if not self.is_message_in_specific_channel(message):
|
47 |
-
logging.debug(f"Message not in specific channel: {message.channel}")
|
48 |
return
|
49 |
if self.is_processing:
|
50 |
-
logging.debug("
|
51 |
return
|
52 |
-
logging.debug("Processing
|
53 |
self.is_processing = True
|
54 |
try:
|
55 |
response = await generate_response(message)
|
56 |
await message.channel.send(response)
|
57 |
except Exception as e:
|
58 |
-
logging.error(f"Error
|
59 |
finally:
|
60 |
self.is_processing = False
|
61 |
|
|
|
39 |
logging.info("Web.py server has been started.")
|
40 |
|
41 |
async def on_message(self, message):
|
42 |
+
logging.debug(f"Message received: {message.content} from {message.author}")
|
43 |
if message.author == self.user:
|
44 |
+
logging.debug("Message from bot itself; ignoring.")
|
45 |
return
|
46 |
if not self.is_message_in_specific_channel(message):
|
47 |
+
logging.debug(f"Message not in the specific channel or its thread: {message.channel}")
|
48 |
return
|
49 |
if self.is_processing:
|
50 |
+
logging.debug("Already processing another message.")
|
51 |
return
|
52 |
+
logging.debug("Processing message...")
|
53 |
self.is_processing = True
|
54 |
try:
|
55 |
response = await generate_response(message)
|
56 |
await message.channel.send(response)
|
57 |
except Exception as e:
|
58 |
+
logging.error(f"Error during message processing: {e}", exc_info=True)
|
59 |
finally:
|
60 |
self.is_processing = False
|
61 |
|