Compare commits

..

No commits in common. "84de0f7eb5975c9ec111a099cfbcc4839df890be" and "7bfa875f05a62a830edb299dbee26338e1ed4576" have entirely different histories.

View file

@ -63,8 +63,8 @@ class ApplicationBot:
if body and body.startswith("!supportbot"): if body and body.startswith("!supportbot"):
await self.handle_command(room, sender, body) await self.handle_command(room, sender, body)
elif body and body.startswith("!apply") and not sender == self.client.user_id: elif body and body.startswith("!apply"):
await self.process_application(room, sender, event) await self.process_application(room, sender, body)
else: else:
await self.relay_message(room, sender, event) await self.relay_message(room, sender, event)
@ -108,7 +108,9 @@ class ApplicationBot:
message_body = event.body message_body = event.body
sender = event.sender sender = event.sender
logging.info(f"Processing reaction {reaction_key} from {sender} in {room.room_id}") logging.info(
f"Processing reaction {reaction_key} from {sender} in {room.room_id}"
)
logging.info(f"Message: {message_body}") logging.info(f"Message: {message_body}")
if message_body.startswith("Application received from"): if message_body.startswith("Application received from"):
@ -201,9 +203,7 @@ class ApplicationBot:
}, },
) )
async def process_application(self, room: MatrixRoom, sender, event): async def process_application(self, room: MatrixRoom, sender, message_body):
message_body = event.body
# Check if the message is from a ticket room # Check if the message is from a ticket room
ticket_id = await self.get_ticket_id_from_room(room.room_id) ticket_id = await self.get_ticket_id_from_room(room.room_id)
if ticket_id: if ticket_id:
@ -221,8 +221,6 @@ class ApplicationBot:
# React to the message with approve, reject, and invite emojis # React to the message with approve, reject, and invite emojis
if isinstance(sent_message, RoomMessageText): if isinstance(sent_message, RoomMessageText):
logging.debug(f"Reacting to message {sent_message.event_id}")
await self.client.room_send( await self.client.room_send(
room.room_id, room.room_id,
"m.reaction", "m.reaction",
@ -257,7 +255,7 @@ class ApplicationBot:
}, },
) )
await self.relay_message(room, sender, event) await self.relay_message(room, sender, message_body)
async def approve_or_reject_application(self, room, sender, command, approved): async def approve_or_reject_application(self, room, sender, command, approved):
user_id = ( user_id = (
@ -679,7 +677,7 @@ class ApplicationBot:
) )
except Exception as e: except Exception as e:
logging.error(f"Failed to relay message of type {type(event)}: {e}") logging.error(f"Failed to relay message of type {type(event)}: {e}")
logging.debug(f"Event source: {event}") logging.debug(f"Event source: {event.source}")
async def help_command(self, room, sender): async def help_command(self, room, sender):
if await self.is_operator(sender): if await self.is_operator(sender):