zakerytclarke commited on
Commit
ad2ccd3
·
verified ·
1 Parent(s): e2b19bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -129,12 +129,16 @@ async def on_message(message):
129
  # Check if the message is from the bot itself to prevent a loop
130
  if message.author == client.user:
131
  return
 
 
 
 
 
132
  print(message.content)
133
 
134
- is_debug = "<debug>" in message.content
135
  async with message.channel.typing():
136
- # Respond with "pong" if the message contains "ping"
137
- response, debug_info = await handle_chat(message.content.replace("<debug>", "").replace("</debug>", ""))
138
 
139
  print(response)
140
  sent_message = await message.reply(response)
 
129
  # Check if the message is from the bot itself to prevent a loop
130
  if message.author == client.user:
131
  return
132
+
133
+ # Exit the function if the bot is not mentioned
134
+ if f'<@{client.user.id}>' not in message.content:
135
+ return
136
+
137
  print(message.content)
138
 
139
+ is_debug = "debug:" in message.content
140
  async with message.channel.typing():
141
+ response, debug_info = await handle_chat(message.content.replace("debug:", ""))
 
142
 
143
  print(response)
144
  sent_message = await message.reply(response)