Update Telethon

Fixes #896
This commit is contained in:
Tulir Asokan
2023-03-10 13:23:14 +02:00
parent 7372e7cbea
commit 6eda8bd165
4 changed files with 17 additions and 5 deletions
+9 -1
View File
@@ -676,7 +676,15 @@ class AbstractUser(ABC):
if not portal:
return
elif portal and not portal.allow_bridging:
self.log.debug(f"Ignoring message in portal {portal.tgid_log} (bridging disallowed)")
self.log.debug(
f"Ignoring message {update.id} in portal {portal.tgid_log} (bridging disallowed)"
)
return
if not portal.mxid and getattr(original_update, "mau_left_channel", False):
self.log.debug(
f"Ignoring message {update.id} in portal {portal.tgid_log} because user isn't in the chat"
)
return
if self.is_relaybot:
+1 -1
View File
@@ -3870,7 +3870,7 @@ class Portal(DBPortal, BasePortal):
return portal
if peer_type:
cls.log.info(f"Creating portal for {peer_type} {tgid} (receiver {tg_receiver})")
cls.log.info(f"Creating portal object for {peer_type} {tgid} (receiver {tg_receiver})")
# TODO enable this for non-release builds
# (or add better wrong peer type error handling)
# if peer_type == "chat":
+6 -2
View File
@@ -52,6 +52,7 @@ from telethon.tl.types import (
User as TLUser,
)
from telethon.tl.types.contacts import ContactsNotModified
from telethon.tl.types.help import AppConfig
from telethon.tl.types.messages import AvailableReactions
from mautrix.appservice import DOUBLE_PUPPET_SOURCE_KEY
@@ -106,6 +107,7 @@ class User(DBUser, AbstractUser, BaseUser):
_available_emoji_reactions_fetched: float
_available_emoji_reactions_lock: asyncio.Lock
_app_config: dict[str, Any] | None
_app_config_hash: int
def __init__(
self,
@@ -143,6 +145,7 @@ class User(DBUser, AbstractUser, BaseUser):
self._available_emoji_reactions_fetched = 0
self._available_emoji_reactions_lock = asyncio.Lock()
self._app_config = None
self._app_config_hash = 0
(
self.relaybot_whitelisted,
@@ -969,8 +972,9 @@ class User(DBUser, AbstractUser, BaseUser):
async def get_app_config(self) -> dict[str, Any]:
if not self._app_config:
cfg = await self.client(GetAppConfigRequest())
self._app_config = util.parse_tl_json(cfg)
cfg: AppConfig = await self.client(GetAppConfigRequest(hash=self._app_config_hash))
self._app_config = util.parse_tl_json(cfg.config)
self._app_config_hash = cfg.hash
return self._app_config
async def get_max_reactions(self, is_premium: bool | None = None) -> int:
+1 -1
View File
@@ -4,7 +4,7 @@ commonmark>=0.8,<0.10
aiohttp>=3,<4
yarl>=1,<2
mautrix>=0.19.4,<0.20
tulir-telethon==1.28.0a4
tulir-telethon==1.28.0a8
asyncpg>=0.20,<0.28
mako>=1,<2
setuptools