Ignore telegram updates in blacklisted chats

This commit is contained in:
Tulir Asokan
2019-10-28 01:21:36 +02:00
parent abd1adaabf
commit 1c662c55cc
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -404,6 +404,9 @@ class AbstractUser(ABC):
async def update_message(self, original_update: UpdateMessage) -> None:
update, sender, portal = self.get_message_details(original_update)
if portal and not portal.allow_bridging:
self.log.debug(f"Ignoring message in portal {portal.tgid_log} (bridging disallowed)")
return
if self.is_bot:
if update.is_private:
@@ -430,10 +433,8 @@ class AbstractUser(ABC):
sender.id)
return await portal.handle_telegram_action(self, sender, update)
user = sender.tgid if sender else "admin"
if isinstance(original_update, (UpdateEditMessage, UpdateEditChannelMessage)):
return await portal.handle_telegram_edit(self, sender, update)
return await portal.handle_telegram_message(self, sender, update)
# endregion
+3 -2
View File
@@ -446,12 +446,13 @@ class BasePortal(ABC):
pass
@abstractmethod
async def _update_title(self, title: str, save: bool = False) -> bool:
async def _update_title(self, title: str, sender: Optional['p.Puppet'] = None,
save: bool = False) -> bool:
pass
@abstractmethod
async def _update_avatar(self, user: 'AbstractUser', photo: Union[TypeChatPhoto],
save: bool = False) -> bool:
sender: Optional['p.Puppet'] = None, save: bool = False) -> bool:
pass
@abstractmethod