diff --git a/example-config.yaml b/example-config.yaml index 02a626af..cfccc342 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -107,6 +107,10 @@ bridge: # Whether or not to automatically synchronize contacts and chats of Matrix users logged into # their Telegram account at startup. startup_sync: true + # Number of most recently active dialogs to check when syncing chats. + # Dialogs include groups and private chats, but only groups are synced. + # Set to 0 to remove limit. + sync_dialog_limit: 30 # The maximum number of simultaneous Telegram deletions to handle. # A large number of simultaneous redactions could put strain on your homeserver. max_telegram_delete: 10 diff --git a/mautrix_telegram/config.py b/mautrix_telegram/config.py index f21ca536..7d283ff5 100644 --- a/mautrix_telegram/config.py +++ b/mautrix_telegram/config.py @@ -203,6 +203,7 @@ class Config(DictWithRecursion): copy("bridge.max_initial_member_sync") copy("bridge.sync_channel_members") copy("bridge.startup_sync") + copy("bridge.sync_dialog_limit") copy("bridge.sync_matrix_state") copy("bridge.max_telegram_delete") copy("bridge.allow_matrix_login") diff --git a/mautrix_telegram/user.py b/mautrix_telegram/user.py index 2f51675c..7821d3bd 100644 --- a/mautrix_telegram/user.py +++ b/mautrix_telegram/user.py @@ -289,7 +289,7 @@ class User(AbstractUser): async def sync_dialogs(self, synchronous_create: bool = False) -> None: creators = [] - for entity in await self.get_dialogs(limit=30): + for entity in await self.get_dialogs(limit=config["bridge.sync_dialog_limit"] or None): portal = po.Portal.get_by_entity(entity) self.portals[portal.tgid_full] = portal creators.append(