Skip to content

Commit

Permalink
update tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
f1delius committed May 13, 2024
1 parent 78b3116 commit e0d70cf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ async def message_callback(self, room: MatrixRoom, event: RoomMessageText) -> No
f"{room.user_name(event.sender)} | {raw_user_message}"
)
tagged = False
# prevent command trigger loop
if event.formatted_body:
if self.bot_username in event.formatted_body or bot_user in raw_user_message:
tagged = True

if bot_user in raw_user_message:
tagged = True
if thread_id:
thread_event_id = thread_id
else:
thread_event_id = reply_to_event_id
dm_tag = room.member_count == 2
# prevent command trigger loop
if self.user_id != event.sender and (tagged or dm_tag):
if self.owner_id != sender_id and self.msg_limit[sender_id] >= 10:
await send_room_message(
Expand All @@ -190,8 +190,6 @@ async def message_callback(self, room: MatrixRoom, event: RoomMessageText) -> No
return
# remove newline character from event.body
content_body = re.sub("\r\n|\r|\n", " ", raw_user_message)
content_body = content_body.replace(
self.bot_username_without_homeserver, '')
try:
if self.workflow:
get_steps = await workflow_steps(self.superagent_url, self.workflow_id, self.api_key, self.httpx_client)
Expand Down

0 comments on commit e0d70cf

Please sign in to comment.