Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,7 @@ class MyClient(discord.Client):
|
|
41 |
async def on_message(self, message):
|
42 |
logging.debug(f"Received message from {message.author}: {message.content}")
|
43 |
if message.author == self.user:
|
|
|
44 |
return
|
45 |
if not self.is_message_in_specific_channel(message):
|
46 |
logging.debug(f"Message not in specific channel: {message.channel}")
|
@@ -48,6 +49,7 @@ async def on_message(self, message):
|
|
48 |
if self.is_processing:
|
49 |
logging.debug("Currently processing another message.")
|
50 |
return
|
|
|
51 |
self.is_processing = True
|
52 |
try:
|
53 |
response = await generate_response(message)
|
@@ -56,7 +58,7 @@ async def on_message(self, message):
|
|
56 |
logging.error(f"Error processing message: {e}", exc_info=True)
|
57 |
finally:
|
58 |
self.is_processing = False
|
59 |
-
|
60 |
|
61 |
def is_message_in_specific_channel(self, message):
|
62 |
return message.channel.id == SPECIFIC_CHANNEL_ID or (
|
|
|
41 |
async def on_message(self, message):
|
42 |
logging.debug(f"Received message from {message.author}: {message.content}")
|
43 |
if message.author == self.user:
|
44 |
+
logging.debug("Ignoring message from the bot itself.")
|
45 |
return
|
46 |
if not self.is_message_in_specific_channel(message):
|
47 |
logging.debug(f"Message not in specific channel: {message.channel}")
|
|
|
49 |
if self.is_processing:
|
50 |
logging.debug("Currently processing another message.")
|
51 |
return
|
52 |
+
logging.debug("Processing new message.")
|
53 |
self.is_processing = True
|
54 |
try:
|
55 |
response = await generate_response(message)
|
|
|
58 |
logging.error(f"Error processing message: {e}", exc_info=True)
|
59 |
finally:
|
60 |
self.is_processing = False
|
61 |
+
|
62 |
|
63 |
def is_message_in_specific_channel(self, message):
|
64 |
return message.channel.id == SPECIFIC_CHANNEL_ID or (
|