Bridge plaintext mentions of Telegram puppets into Telegram mentions

This commit is contained in:
Tulir Asokan
2018-03-08 18:39:27 +02:00
parent 150321a4d7
commit 61d9d6890a
6 changed files with 76 additions and 8 deletions
+15
View File
@@ -191,6 +191,21 @@ class Puppet:
return None
@classmethod
def find_by_displayname(cls, displayname):
if not displayname:
return None
for _, puppet in cls.cache.items():
if puppet.displayname and puppet.displayname == displayname:
return puppet
puppet = DBPuppet.query.filter(DBPuppet.displayname == displayname).one_or_none()
if puppet:
return cls.from_db(puppet)
return None
def init(context):
global config