Add support for Telethon's catch_up() (ref #124)

This commit is contained in:
Tulir Asokan
2018-05-13 11:22:20 +03:00
parent fd763b953d
commit 79341b8d28
5 changed files with 13 additions and 1 deletions
+6
View File
@@ -86,6 +86,12 @@ class Bot(AbstractUser):
except (ChannelPrivateError, ChannelInvalidError):
self.remove_chat(id.channel_id)
if config["bridge.catch_up"]:
try:
await self.client.catch_up()
except Exception:
self.log.exception("Failed to run catch_up() for bot")
def register_portal(self, portal: po.Portal):
self.add_chat(portal.tgid, portal.peer_type)
+1
View File
@@ -179,6 +179,7 @@ class Config(DictWithRecursion):
copy("bridge.plaintext_highlights")
copy("bridge.public_portals")
copy("bridge.native_stickers")
copy("bridge.catch_up")
copy("bridge.command_prefix")
+2
View File
@@ -150,6 +150,8 @@ class User(AbstractUser):
await self.update_info(info)
await self.sync_dialogs()
await self.sync_contacts()
if config["bridge.catch_up"]:
await self.client.catch_up()
except Exception:
self.log.exception("Failed to run post-login functions")