Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

feat: ✨ trigger the bot by mentioning it #81

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions simplematrixbotlib/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ def mention(self):
Returns True if the message begins with the bot's username, MXID, or pill targeting the MXID, and False otherwise.
"""

for i in [self._display_name, self._disambiguated_name, self.room.own_user_id, self._pill]:
body = self.event.formatted_body or self.event.body
if body.startswith(i):
return True

for body in (self.event.formatted_body, self.event.body):
for id in [self._display_name, self._disambiguated_name, self.room.own_user_id, self._pill]:
if body.startswith(id):
return True
HarHarLinks marked this conversation as resolved.
Show resolved Hide resolved
return False

def args(self):
Expand Down