patch 6017f51ba8b0e51288cb9ed128f5caa6aa304088
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sun Feb 27 00:47:48 CET 2022
* irc: Add service/control user (TelegramServ), by now without functions
hunk ./irc.py 140
+ self.service_user = IRCUser(None, ('Services.{}'.format(self.hostname),), self.conf['service_user'],
+ 'Control', 'Telegram Service', is_service=True)
+ self.users[self.conf['service_user'].lower()] = self.service_user
hunk ./irc.py 357
- elif usr.tls or not usr.stream:
+ elif usr.tls or (not usr.stream and not usr.is_service):
hunk ./irc.py 361
+ if usr.is_service:
+ await self.reply_code(user, 'RPL_WHOISSERVICE', (real_ni,))
hunk ./irc.py 381
+ if self.service_user.irc_nick.lower() == tgl:
+ # TODO: handle serivce command
+ return
hunk ./irc.py 586
- def __init__(self, stream, address, irc_nick=None, username='', realname=None):
+ def __init__(self, stream, address, irc_nick=None, username='', realname=None, is_service=False):
hunk ./irc.py 599
+ self.is_service = is_service
hunk ./irc_replies.py 18
+ 'RPL_WHOISSERVICE': ('310', '{} :is an irgramd service'),
hunk ./irgramd 81
+ tornado.options.define('service_user', default='TelegramServ', metavar='SERVICE_NICK', help='Nick of the service/control user, must be a nick not used by a real Telegram user')
hunk ./telegram.py 204
+ if self.irc.users[irc_nick].is_service:
+ return None
hunk ./telegram.py 224
- if self.irc.users[irc_nick].stream:
+ user = self.irc.users[irc_nick]
+ if user.stream or user.is_service:
hunk ./telegram.py 228
- bot = self.irc.users[irc_nick].bot
+ bot = user.bot
hunk ./telegram.py 231
- user = await self.telegram_client.get_entity(tid)
- bot = user.bot
- self.irc.users[irc_nick].bot = bot
+ tg_user = await self.telegram_client.get_entity(tid)
+ bot = tg_user.bot
+ user.bot = bot