patch 5b3071c8f389341108b84aad6b91351a118cddb0
Author: E. Bosch <presidev@AT@gmail.com>
Date: Thu Apr 20 01:49:15 CEST 2023
* telegram: Relocate is_bot() method, to have get_* methods together
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-11-22 16:52:04.833804321 +0100
+++ new-irgramd/telegram.py 2024-11-22 16:52:04.833804321 +0100
@@ -243,19 +243,6 @@
idle = None
return idle
- async def is_bot(self, irc_nick, tid=None):
- user = self.irc.users[irc_nick]
- if user.stream or user.is_service:
- bot = False
- else:
- bot = user.bot
- if bot == None:
- tid = self.get_tid(irc_nick, tid)
- tg_user = await self.telegram_client.get_entity(tid)
- bot = tg_user.bot
- user.bot = bot
- return bot
-
async def get_channel_topic(self, channel, entity_cache):
tid = self.get_tid(channel)
# entity_cache should be a list to be a persistent and by reference value
@@ -311,6 +298,19 @@
return short if format == 'short' else long
+ async def is_bot(self, irc_nick, tid=None):
+ user = self.irc.users[irc_nick]
+ if user.stream or user.is_service:
+ bot = False
+ else:
+ bot = user.bot
+ if bot == None:
+ tid = self.get_tid(irc_nick, tid)
+ tg_user = await self.telegram_client.get_entity(tid)
+ bot = tg_user.bot
+ user.bot = bot
+ return bot
+
def add_to_cache(self, id, mid, message, proc_message, user, chan):
if len(self.cache) >= 10000:
self.cache.popitem(last=False)