Fetch participant count if it's not included in the entity

This commit is contained in:
Tulir Asokan
2022-06-23 23:59:44 +03:00
parent e1a5e30a75
commit 0e024b3b7c
+4 -1
View File
@@ -755,7 +755,10 @@ class Portal(DBPortal, BasePortal):
participants_count = entity.participants_count
elif isinstance(entity, Channel) and not entity.broadcast:
participants_count = entity.participants_count
if 0 < self.config["bridge.max_member_count"] < participants_count:
if participants_count is None and self.config["bridge.max_member_count"] > 0:
self.log.warning(f"Participant count not found in entity, fetching manually")
participants_count = (await user.client.get_participants(entity, limit=0)).total
if participants_count and 0 < self.config["bridge.max_member_count"] < participants_count:
self.log.warning(f"Not bridging chat, too many participants (%d)", participants_count)
self._bridging_blocked_at_runtime = True
return None