patch 10725c4fff915a1c95e95b5f998f26c97b146d5e
Author: E. Bosch <presidev@AT@gmail.com>
Date:   Wed Jan 22 00:35:42 CET 2025
  * telegram: Try to fix ChatAdminRequiredError when getting participants from a channel
  reported in https://github.com/prsai/irgramd/issues/1
hunk ./telegram.py 180
-        async for user in self.telegram_client.iter_participants(chat.id):
-            user_nick = self.set_ircuser_from_telegram(user)
-            if not user.is_self:
-                self.irc.irc_channels[chan].add(user_nick)
-            # Add admin users as ops in irc
-            if isinstance(user.participant, tgty.ChatParticipantAdmin) or \
-               isinstance(user.participant, tgty.ChannelParticipantAdmin):
-                self.irc.irc_channels_ops[chan].add(user_nick)
-            # Add creator users as founders in irc
-            elif isinstance(user.participant, tgty.ChatParticipantCreator) or \
-                 isinstance(user.participant, tgty.ChannelParticipantCreator):
-                self.irc.irc_channels_founder[chan].add(user_nick)
+        try:
+            async for user in self.telegram_client.iter_participants(chat.id):
+                user_nick = self.set_ircuser_from_telegram(user)
+                if not user.is_self:
+                    self.irc.irc_channels[chan].add(user_nick)
+                # Add admin users as ops in irc
+                if isinstance(user.participant, tgty.ChatParticipantAdmin) or \
+                   isinstance(user.participant, tgty.ChannelParticipantAdmin):
+                    self.irc.irc_channels_ops[chan].add(user_nick)
+                # Add creator users as founders in irc
+                elif isinstance(user.participant, tgty.ChatParticipantCreator) or \
+                     isinstance(user.participant, tgty.ChannelParticipantCreator):
+                    self.irc.irc_channels_founder[chan].add(user_nick)
+        except:
+            self.logger.warning('Not possible to get participants of channel %s', channel)
patch 0c96892ec68150c96ef7ba50ec4e2db3db2296e4
Author: E. Bosch <presidev@AT@gmail.com>
Date:   Thu Jan 16 22:00:14 CET 2025
  * exclam: Fix send a reaction when there was already a previous reaction from other user on the same message,
  for some reason the 'message' attribute is not received
hunk ./exclam.py 208
-                        self.tmp_tg_msg = update.updates[0].message
-                        reply = True
+                        self.tmp_tg_msg = getattr(update.updates[0], 'message', None)
+                        reply = bool(self.tmp_tg_msg)
patch 89bc0957a4fb31bf8066e338bc4548cd2d52c821
Author: E. Bosch <presidev@AT@gmail.com>
Date:   Sat Nov  2 20:20:45 CET 2024
  * telegram, irc: Set topic in IRC with Telegram channel/chat description
hunk ./include.py 14
+MAX_LINE                     = 400
hunk ./irc.py 21
-from include import VERSION, CHAN_MAX_LENGTH, NICK_MAX_LENGTH
+from include import VERSION, CHAN_MAX_LENGTH, NICK_MAX_LENGTH, MAX_LINE
hunk ./irc.py 262
-                await self.reply_code(user, 'RPL_LIST', (real_chan, users_count, topic))
+                await self.reply_code(user, 'RPL_LIST', (real_chan, users_count, topic[:MAX_LINE]))
hunk ./irc.py 615
-        await self.reply_code(user, 'RPL_TOPIC', (channel, topic))
+        await self.reply_code(user, 'RPL_TOPIC', (channel, topic[:MAX_LINE]))
hunk ./telegram.py 18
-from telethon.tl.functions.messages import GetMessagesReactionsRequest
+from telethon.tl.functions.messages import GetMessagesReactionsRequest, GetFullChatRequest
+from telethon.tl.functions.channels import GetFullChannelRequest
hunk ./telegram.py 313
+        if isinstance(entity, tgty.Channel): [_$_]
+            full = await self.telegram_client(GetFullChannelRequest(channel=entity))
+        elif isinstance(entity, tgty.Chat):
+            full = await self.telegram_client(GetFullChatRequest(chat_id=tid))
+        else:
+            return ''
hunk ./telegram.py 320
-        return 'Telegram ' + entity_type + ' ' + str(tid) + ': ' + entity.title
+        topic = full.full_chat.about
+        sep = ': ' if topic else ''
+        return entity_type + sep + topic
hunk ./utils.py 23
+from include import MAX_LINE
+
hunk ./utils.py 66
-    MAX = 400
hunk ./utils.py 67
-    wr = textwrap.TextWrapper(width=MAX)
+    wr = textwrap.TextWrapper(width=MAX_LINE)
patch 86ef89f9f9220ecde8477db2aa673f94f32656ab
Author: E. Bosch <presidev@AT@gmail.com>
Date:   Sat Oct 26 20:43:28 CEST 2024
  * telegram: Fix op and founder detection in channels
hunk ./telegram.py 184
-            if isinstance(user.participant, tgty.ChatParticipantAdmin):
+            if isinstance(user.participant, tgty.ChatParticipantAdmin) or \
+               isinstance(user.participant, tgty.ChannelParticipantAdmin):
hunk ./telegram.py 188
-            elif isinstance(user.participant, tgty.ChatParticipantCreator):
+            elif isinstance(user.participant, tgty.ChatParticipantCreator) or \
+                 isinstance(user.participant, tgty.ChannelParticipantCreator):
patch 6d99fce9643fbdda1594f99331f4a4642ecc7f0f
Author: E. Bosch <presidev@AT@gmail.com>
Date:   Sat Oct 26 20:35:11 CEST 2024
  * telegram: Fix handler for next reactions when the event is empty
hunk ./telegram.py 577
-        react = max(reactions, key=lambda y: y.date)
-        [_$_]
-        if self.last_reaction != react.date:
+        react = max(reactions, key=lambda y: y.date) if reactions else None
+
+        if react and self.last_reaction != react.date:
patch efaf8df4b3fa314997615e2fc07a3decb3a7cfba
Author: E. Bosch <presidev@AT@gmail.com>
Date:   Sat Oct 26 13:01:02 CEST 2024
  * exclam: Reorder handler list so commands are listed ordered in help
hunk ./exclam.py 21
-            '!re':        (self.handle_command_re,                    2,  2,  2),
-            '!ed':        (self.handle_command_ed,                    2,  2,  2),
hunk ./exclam.py 22
+            '!ed':        (self.handle_command_ed,                    2,  2,  2),
hunk ./exclam.py 24
-            '!upl':       (self.handle_command_upl,                   1,  2,  2),
-            '!reupl':     (self.handle_command_reupl,                 2,  3,  3),
+            '!re':        (self.handle_command_re,                    2,  2,  2),
hunk ./exclam.py 26
+            '!reupl':     (self.handle_command_reupl,                 2,  3,  3),
+            '!upl':       (self.handle_command_upl,                   1,  2,  2),