Remove voices functionality
patch 4e31d63e717768dbe39a3808f54b9e12627a687b
Author: E. Bosch <presidev@AT@gmail.com>
Date: Tue Nov 24 21:11:50 CET 2020
* Remove voices functionality
hunk ./irc.py 14
-# Configuration
-
-UPDATE_CHANNEL_VOICES_DELAY = 300
-
hunk ./irc.py 69
- self.irc_voices = collections.defaultdict(set)
hunk ./irc.py 136
- nicks, voices = await self.tg.get_telegram_channel_participants(tid)
+ nicks = await self.tg.get_telegram_channel_participants(tid)
hunk ./irc.py 150
- # Update voices
- await self.update_channel_voices(channel, voices)
-
hunk ./irc.py 155
-
- async def update_channel_voices(self, channel, voices=None):
- # Get voices for channel if not provided
- if not voices:
- tid = self.iid_to_tid[channel]
- _, voices = await self.tg.get_telegram_channel_participants(tid)
-
- # Add new voices
- for nick in voices:
- if nick not in self.irc_voices[channel]:
- self.irc_voices[channel].add(nick)
- await self.send_irc_command(':{} MODE {} +v {}'.format(
- self.hostname, channel, nick,
- ))
-
- # Remove old voices
- for nick in self.irc_voices[channel].difference(voices):
- self.irc_voices[channel].remove(nick)
- await self.send_irc_command(':{} MODE {} -v {}'.format(
- self.hostname, channel, nick,
- ))
-
- self.ioloop.call_later(UPDATE_CHANNEL_VOICES_DELAY, self.update_channel_voices, channel)
-
hunk ./telegram.py 99
- voices = set()
hunk ./telegram.py 102
- if isinstance(user.status, telethon.types.UserStatusOnline):
- voices.add(user_nick)
-
hunk ./telegram.py 105
- return nicks, voices
+ return nicks