Record channel admins in Telegram as ops in IRC, and channel creators in Telegram as creators/founders in IRC
patch 5c06638983343c88cd73232a723f5efa09fed082
Author: E. Bosch <presidev@AT@gmail.com>
Date: Mon Feb 1 23:18:25 CET 2021
* Record channel admins in Telegram as ops in IRC, and channel creators in Telegram as creators/founders in IRC
hunk ./irc.py 97
+ self.irc_channels_ops = collections.defaultdict(set)
+ self.irc_channels_founder = {}
hunk ./irc.py 203
- self.irc_channels[channel.lower()].add(user.irc_nick)
+ chan = channel.lower()
+ self.irc_channels[chan].add(user.irc_nick)
hunk ./telegram.py 5
+from telethon import types as tgty
hunk ./telegram.py 69
- if isinstance(chat, telethon.types.User):
+ if isinstance(chat, tgty.User):
hunk ./telegram.py 90
+ chan = channel.lower()
hunk ./telegram.py 92
- for user in [x async for x in self.telegram_client.iter_participants(chat.id) if not x.is_self]:
+ async for user in self.telegram_client.iter_participants(chat.id):
hunk ./telegram.py 94
- self.irc.irc_channels[channel.lower()].add(user_nick)
+ 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):
+ self.irc.irc_channels_ops[chan].add(user_nick)
+ # Add creator users as founders in irc
+ elif isinstance(user.participant, tgty.ChatParticipantCreator):
+ self.irc.irc_channels_founder[chan] = user_nick
hunk ./telegram.py 228
- if not isinstance(chat, telethon.types.User):
+ if not isinstance(chat, tgty.User):