Add Telegram display name to WHOIS for self user (me)
patch bee27c3c443c6fbca835bf662f253d2270c6d76a
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sat Feb 5 03:30:31 CET 2022
* Add Telegram display name to WHOIS for self user (me)
diff -rN -u old-irgramd/irc.py new-irgramd/irc.py
--- old-irgramd/irc.py 2024-11-22 15:54:33.427382723 +0100
+++ new-irgramd/irc.py 2024-11-22 15:54:33.431382716 +0100
@@ -329,7 +329,8 @@
if idle != None: await self.reply_code(user, 'RPL_WHOISIDLE', (real_ni, idle))
if usr.oper: await self.reply_code(user, 'RPL_WHOISOPERATOR', (real_ni,))
if usr.stream: await self.reply_code(user, 'RPL_WHOISACCOUNT', (real_ni,
- '{}!{}@Telegram'.format(self.tg.tg_username, self.tg.id
+ '{}|{}!{}@Telegram'.format(self.tg.tg_username,
+ await self.tg.get_telegram_display_name_me(), self.tg.id
)))
if await self.tg.is_bot(ni):
await self.reply_code(user, 'RPL_WHOISBOT', (real_ni,))
diff -rN -u old-irgramd/irc_replies.py new-irgramd/irc_replies.py
--- old-irgramd/irc_replies.py 2024-11-22 15:54:33.431382716 +0100
+++ new-irgramd/irc_replies.py 2024-11-22 15:54:33.431382716 +0100
@@ -20,7 +20,7 @@
'RPL_LISTEND': ('323', ':End of /LIST'),
'RPL_CHANNELMODEIS': ('324', '{} {} {}'),
'RPL_CREATIONTIME': ('329', '{} {}'),
- 'RPL_WHOISACCOUNT': ('330', '{} {} :Telegram name'),
+ 'RPL_WHOISACCOUNT': ('330', '{} {} :has Telegram account'),
'RPL_TOPIC': ('332', '{} :{}'),
'RPL_TOPICWHOTIME': ('333', '{} {} {}'),
'RPL_WHOISBOT': ('335', '{} :is a Telegram bot'),
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-11-22 15:54:33.431382716 +0100
+++ new-irgramd/telegram.py 2024-11-22 15:54:33.431382716 +0100
@@ -131,6 +131,10 @@
name = name.replace(' ', '_')
return name
+ async def get_telegram_display_name_me(self):
+ tg_user = await self.telegram_client.get_me()
+ return self.get_telegram_display_name(tg_user)
+
def get_telegram_channel(self, chat):
return '#' + chat.title.replace(' ', '-')