patch 5b3071c8f389341108b84aad6b91351a118cddb0 Author: E. Bosch 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-10-23 04:23:53.608222839 +0200 +++ new-irgramd/telegram.py 2024-10-23 04:23:53.608222839 +0200 @@ -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)