Fix random bugs and update mautrix-python

This commit is contained in:
Tulir Asokan
2020-10-24 21:13:57 +03:00
parent a3f6bc2acb
commit 70a6b847e2
3 changed files with 7 additions and 4 deletions
+5 -2
View File
@@ -455,8 +455,11 @@ class PortalTelegram(BasePortal, ABC):
else self.tgid)) else self.tgid))
min_id = last.tgid if last else 0 min_id = last.tgid if last else 0
if last_id is None: if last_id is None:
message = (await source.client.get_messages(self.peer, limit=1))[0] messages = await source.client.get_messages(self.peer, limit=1)
last_id = message.id if not messages:
# The chat seems empty
return
last_id = messages[0].id
if last_id <= min_id: if last_id <= min_id:
# Nothing to backfill # Nothing to backfill
return return
+1 -1
View File
@@ -262,7 +262,7 @@ class Puppet(BasePuppet):
allow_because = "user is bot" allow_because = "user is bot"
elif self.displayname_source == source.tgid: elif self.displayname_source == source.tgid:
allow_because = "user is the primary source" allow_because = "user is the primary source"
elif not info.contact: elif not isinstance(info, UpdateUserName) and not info.contact:
allow_because = "user is not a contact" allow_because = "user is not a contact"
elif self.displayname_source is None: elif self.displayname_source is None:
allow_because = "no primary source set" allow_because = "no primary source set"
+1 -1
View File
@@ -5,6 +5,6 @@ python-magic>=0.4,<0.5
commonmark>=0.8,<0.10 commonmark>=0.8,<0.10
aiohttp>=3,<3.7 aiohttp>=3,<3.7
yarl<1.6 yarl<1.6
mautrix==0.8.0.beta10 mautrix==0.8.0rc1
telethon>=1.17,<1.18 telethon>=1.17,<1.18
telethon-session-sqlalchemy>=0.2.14,<0.3 telethon-session-sqlalchemy>=0.2.14,<0.3