From b707c394137a2672d5ff54a7f612e677b71494b0 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Fri, 21 Oct 2022 05:38:16 -0400 Subject: [PATCH] use get_peer_id() instead of PeerChannel --- simplebot_tgchan/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simplebot_tgchan/__init__.py b/simplebot_tgchan/__init__.py index ace971f..ae001b5 100644 --- a/simplebot_tgchan/__init__.py +++ b/simplebot_tgchan/__init__.py @@ -12,7 +12,7 @@ from telethon import TelegramClient from telethon.tl.functions.channels import JoinChannelRequest from telethon.tl.functions.messages import ImportChatInviteRequest -from telethon.tl.types import PeerChannel +from telethon.utils import get_peer_id from .orm import Channel, Subscription, init, session_scope from .subcommands import login @@ -189,7 +189,7 @@ async def check_channels(bot: DeltaBot) -> None: async def check_channel(bot: DeltaBot, client: TelegramClient, dbchan: Channel) -> None: - channel = await client.get_entity(PeerChannel(dbchan.id)) + channel = await client.get_entity(get_peer_id(dbchan.id)) dbchan.title = channel.title messages = list( reversed(await client.get_messages(channel, min_id=dbchan.last_msg, limit=20))