telegram: Use positive IDs when checking if a channel already exists when a new message is received
patch 830950349c796059b0bbe9759c277846252d6db6
Author: E. Bosch <presidev@AT@gmail.com>
Date: Wed Mar 22 22:15:41 CET 2023
* telegram: Use positive IDs when checking if a channel already exists when a new message is received
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-10-23 06:32:29.971343217 +0200
+++ new-irgramd/telegram.py 2024-10-23 06:32:29.971343217 +0200
@@ -14,7 +14,7 @@
import aioconsole
import asyncio
import telethon
-from telethon import types as tgty
+from telethon import types as tgty, utils as tgutils
# Local modules
@@ -197,13 +197,14 @@
return self.tid_to_iid[tid]
async def get_irc_channel_from_telegram_id(self, tid, entity=None):
- if tid not in self.tid_to_iid:
+ rtid, type = tgutils.resolve_id(tid)
+ if rtid not in self.tid_to_iid:
chat = entity or await self.telegram_client.get_entity(tid)
channel = self.get_telegram_channel(chat)
- self.tid_to_iid[tid] = channel
- self.irc.iid_to_tid[channel] = tid
+ self.tid_to_iid[rtid] = channel
+ self.irc.iid_to_tid[channel] = rtid
- return self.tid_to_iid[tid]
+ return self.tid_to_iid[rtid]
async def get_telegram_channel_participants(self, tid):
channel = self.tid_to_iid[tid]