Add support for /command@bot bot command syntax

This commit is contained in:
Tulir Asokan
2018-02-24 12:57:18 +02:00
parent 8a7ccc0007
commit 55046e15b2
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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):
+1 -1
View File
@@ -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):