Add support for /command@bot bot command syntax
This commit is contained in:
@@ -127,9 +127,9 @@ class Bot(AbstractUser):
|
||||
|
||||
text = message.message
|
||||
portal = po.Portal.get_by_entity(message.to_id)
|
||||
if text == "/portal":
|
||||
if text == "/portal" or text == f"/portal@{self.username}":
|
||||
await self.handle_command_portal(portal, reply)
|
||||
elif text.startswith("/invite"):
|
||||
elif text.startswith("/invite") or text.startswith(f"/invite@{self.username}"):
|
||||
await self.handle_command_invite(portal, reply, mxid=text[len("/invite "):])
|
||||
|
||||
async def update(self, update):
|
||||
|
||||
@@ -210,7 +210,7 @@ class MatrixParser(HTMLParser):
|
||||
self.entities.append(entity)
|
||||
|
||||
|
||||
command_regex = re.compile("(\s|^)!([A-Za-z0-9]+)")
|
||||
command_regex = re.compile("(\s|^)!([A-Za-z0-9@]+)")
|
||||
|
||||
|
||||
def matrix_text_to_telegram(text):
|
||||
|
||||
Reference in New Issue
Block a user