Add Matrix->Telegram kicking and fix and improve things. Fixes #36
This commit is contained in:
@@ -70,8 +70,8 @@ class Puppet:
|
||||
"first name": info.first_name,
|
||||
"last name": info.last_name,
|
||||
}
|
||||
preferences = config.get("bridge", {}).get("displayname_preference",
|
||||
["full name", "username", "phone"])
|
||||
preferences = config.get("bridge.displayname_preference",
|
||||
["full name", "username", "phone"])
|
||||
for preference in preferences:
|
||||
name = data[preference]
|
||||
if name:
|
||||
@@ -136,6 +136,18 @@ class Puppet:
|
||||
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_by_mxid(cls, mxid, create=True):
|
||||
tgid = cls.get_id_from_mxid(mxid)
|
||||
return cls.get(tgid, create) if tgid else None
|
||||
|
||||
@classmethod
|
||||
def get_id_from_mxid(cls, mxid):
|
||||
match = cls.mxid_regex.match(mxid)
|
||||
if match:
|
||||
return int(match.group(1))
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def find_by_username(cls, username):
|
||||
for _, puppet in cls.cache.items():
|
||||
|
||||
Reference in New Issue
Block a user