This commit is contained in:
Cyberes 2023-03-19 19:54:16 -06:00
parent f55d3b41b0
commit 07e87bc3c7
1 changed files with 6 additions and 4 deletions

View File

@ -61,10 +61,6 @@ class Callbacks:
event: The event defining the message. event: The event defining the message.
""" """
# Extract the message text # Extract the message text
msg = event.body.strip().strip('\n')
logger.debug(f"Bot message received from {event.sender} in {room.room_id} --> {msg}")
await self.client.room_read_markers(room.room_id, event.event_id, event.event_id) await self.client.room_read_markers(room.room_id, event.event_id, event.event_id)
# Ignore messages from ourselves # Ignore messages from ourselves
@ -81,6 +77,10 @@ class Callbacks:
logger.debug(f'Skipping seen event: {event.event_id}') logger.debug(f'Skipping seen event: {event.event_id}')
return return
msg = event.body.strip().strip('\n')
logger.debug(f"Bot message received from {event.sender} in {room.room_id} --> {msg}")
# if room.member_count > 2: # if room.member_count > 2:
# has_command_prefix = # has_command_prefix =
# else: # else:
@ -91,6 +91,8 @@ class Callbacks:
# room.member_count > 2 ... we assume a public room # room.member_count > 2 ... we assume a public room
# room.member_count <= 2 ... we assume a DM # room.member_count <= 2 ... we assume a DM
# General message listener # General message listener
logger.info(is_thread(event))
if not msg.startswith(f'{self.command_prefix} ') and is_thread(event) and (await is_this_our_thread(self.client, room, event, self.command_prefix)): if not msg.startswith(f'{self.command_prefix} ') and is_thread(event) and (await is_this_our_thread(self.client, room, event, self.command_prefix)):
await self.client.room_typing(room.room_id, typing_state=True, timeout=3000) await self.client.room_typing(room.room_id, typing_state=True, timeout=3000)
thread_content = await get_thread_content(self.client, room, event) thread_content = await get_thread_content(self.client, room, event)