fix(bot): prevent self-sending of "!apply" commands
Ensure that the bot ignores "!apply" commands sent by itself to avoid unnecessary processing and potential loops. Also, add logging for message reactions to aid in debugging and monitoring.
This commit is contained in:
parent
372a719de0
commit
84de0f7eb5
1 changed files with 3 additions and 1 deletions
|
@ -63,7 +63,7 @@ class ApplicationBot:
|
|||
|
||||
if body and body.startswith("!supportbot"):
|
||||
await self.handle_command(room, sender, body)
|
||||
elif body and body.startswith("!apply"):
|
||||
elif body and body.startswith("!apply") and not sender == self.client.user_id:
|
||||
await self.process_application(room, sender, event)
|
||||
else:
|
||||
await self.relay_message(room, sender, event)
|
||||
|
@ -221,6 +221,8 @@ class ApplicationBot:
|
|||
|
||||
# React to the message with approve, reject, and invite emojis
|
||||
if isinstance(sent_message, RoomMessageText):
|
||||
logging.debug(f"Reacting to message {sent_message.event_id}")
|
||||
|
||||
await self.client.room_send(
|
||||
room.room_id,
|
||||
"m.reaction",
|
||||
|
|
Loading…
Reference in a new issue