Add "initial_help" option (by default True) to enable or disable initial help message from TelegramServ --> to head
patch 9c530196db77dfde94d09e8dfbee848665084731
Author: Lucas de Sena <lucas@seninha.org>
Date: Sat Jul 25 00:27:23 CEST 2026
* Merge pull request #16 on github from phillbush/show-reactions
add "show_reactions" option
Set it to false if you do not want to be annoyed with reactions and emojis.
hunk ./irgramd 107
+ tornado.options.define('show_reactions', default=True, help='Show reactions to messages')
hunk ./telegram.py 60
+ self.show_react = settings['show_reactions']
hunk ./telegram.py 601
+ if not self.show_react:
+ return
hunk ./telegram.py 618
+ if not self.show_react:
+ return
patch b785776c7df3016fb9c83aa7f7b9e51815435bab
Author: E. Bosch <presidev@AT@gmail.com>
Date: Thu Jul 23 18:06:45 CEST 2026
* Merge pull request #18 on github from phillbush/message-deleted-not-in-cache along with an option to configure the new behaviour
move "Message id ... deleted not in cache" into logger
TelegramServ can get filled with warnings like
Message id 012345 deleted not in cache
if you are in a channel/group that automatically deletes messages after
a certain time, and the deleted message is not in cache.
Warn that in the logger.
With "info" severity, because that's not actually an issue, just
something that can happen.
Add option "log_deleted" to enable this, by default false (use TelegramServ)
hunk ./irgramd 97
+ tornado.options.define('log_deleted', default=False, help='Deleted messages not in cache are logged, if disabled service user [TelegramServ] will notify them')
hunk ./telegram.py 63
+ self.log_del = settings['log_deleted']
hunk ./telegram.py 649
- text = 'Message id {} deleted not in cache'.format(deleted_id)
- await self.relay_telegram_private_message(self.irc.service_user, text)
+ if self.log_del:
+ self.logger.info('Message id {} deleted not in cache'.format(deleted_id))
+ else:
+ text = 'Message id {} deleted not in cache'.format(deleted_id)
+ await self.relay_telegram_private_message(self.irc.service_user, text)
patch fae93b3a3f74e5858d8bf4f090f8ed245894e4c9
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sun Jul 19 22:35:25 CEST 2026
* telegram: Add support for 2nd factor authentication (2FA) password for Telegram accounts that have it enabled.
This will work consistenly with "ask_code" option whether True or False.
Refactored authentication code to not produce too many login code requests
to avoid bans. Improve error logging.
Remove the use of aioconsole, use to_thread with standard functions instead.
hunk ./README.md 58
+- Login code and 2FA password support for Telegram
hunk ./README.md 67
-- [aioconsole] (tested with v0.6.1)
hunk ./irgramd 81
- tornado.options.define('ask_code', default=False, help='Ask authentication code (sent by Telegram) in console instead of "code" service command in IRC')
+ tornado.options.define('ask_code', default=False, help='Ask authentication code (sent by Telegram) and 2FA password (if enabled) in console instead of "code" service command in IRC')
hunk ./service.py 11
+from telethon.errors.rpcerrorlist import SessionPasswordNeededError
hunk ./service.py 17
- 'code': (self.handle_command_code, 1, 1, -1),
+ 'code': (self.handle_command_code, 1, 2, -1),
hunk ./service.py 45
- 'use /msg {} code <code>'.format(self.irc.service_user.irc_nick),
- 'e.g. /msg {} code 12345'.format(self.irc.service_user.irc_nick)
+ 'use /msg or equivalent in your IRC client',
+ 'e.g. /msg {} code 12345'.format(self.irc.service_user.irc_nick),
+ 'If 2nd authentication factor (2FA) password is enabled in',
+ 'your account, you must provide it as well',
+ 'e.g. /msg {} code 12345 password'.format(self.irc.service_user.irc_nick),
hunk ./service.py 52
- async def handle_command_code(self, code=None, help=None):
+ async def handle_command_code(self, code=None, passw=None, help=None):
hunk ./service.py 57
+ valid_auth = True
hunk ./service.py 60
+ except SessionPasswordNeededError:
+ try:
+ await self.tg.telegram_client.sign_in(password=passw)
+ except:
+ reply = ('Invalid 2FA password',)
+ valid_auth = False
hunk ./service.py 68
- else:
- reply = ('Valid code', 'Telegram account authorized')
+ valid_auth = False
+ if valid_auth:
+ reply = ('Valid authentication', 'Telegram account authorized')
hunk ./service.py 76
- reply = (' code Enter authorization code',)
+ reply = (' code Enter authorization code and 2FA password',)
hunk ./service.py 80
- ' code <code>',
+ ' code <code> [<password>]',
hunk ./service.py 82
- 'another client connected.',
- 'This authorization code usually is only needed the first time',
+ 'another client connected. If 2nd factor authentication (2FA) password',
+ 'is enabled in your account, must be provided too.',
+ 'This authentication usually is only needed the first time',
hunk ./telegram.py 13
-import aioconsole
hunk ./telegram.py 16
+from getpass import getpass
hunk ./telegram.py 20
+from telethon.errors.rpcerrorlist import SessionPasswordNeededError
hunk ./telegram.py 127
- while not await self.telegram_client.is_user_authorized():
+ if not await self.telegram_client.is_user_authorized():
hunk ./telegram.py 133
- self.logger.info('You must provide the Login code that Telegram will '
- 'sent you via SMS or another connected client')
- code = await aioconsole.ainput('Login code: ')
+ attempts_msg = ('After 3 failed authentication attempts, aborted. '
+ 'Please restart irgramd to try again')
+ count = 1
+ while not await self.telegram_client.is_user_authorized():
+ if count > 3:
+ self.logger.error(attempts_msg)
+ return
+ await asyncio.to_thread(print, 'You must provide the Login code that Telegram will '
+ 'sent you via SMS or another connected client')
+ code = await asyncio.to_thread(input, 'Login code: ')
hunk ./telegram.py 145
- except:
- pass
+ except SessionPasswordNeededError:
+ count = 1
+ while not await self.telegram_client.is_user_authorized():
+ if count > 3:
+ self.logger.error(attempts_msg)
+ return
+ await asyncio.to_thread(print, '2nd factor authentication (2FA) password is enabled '
+ 'in your account, you must provide it')
+ passw = await asyncio.to_thread(getpass, 'Password (not shown): ')
+ try:
+ await self.telegram_client.sign_in(password=passw)
+ except BaseException as err:
+ self.logger.error(repr(err))
+ count += 1
+ except BaseException as err:
+ self.logger.error(repr(err))
+ count += 1
patch 2922f89ba9e3b2a0983b0e564ce29105e670c3f2
Author: E. Bosch <presidev@AT@gmail.com>
Date: Tue Jul 14 11:30:59 CEST 2026
* service: In auth help add separator if there is init help only
hunk ./service.py 24
+ self.init_help = settings['initial_help']
hunk ./service.py 38
+ sep = '----' if self.init_help else ''
hunk ./service.py 40
- '----',
+ sep,
patch 7f3352bbc9fe55c1c399495c13e36549390d9b07
Author: E. Bosch <presidev@AT@gmail.com>
Date: Tue Jul 14 01:15:16 CEST 2026
* Move auth help from irc.py to service.py
hunk ./irc.py 543
- for line in (
- '----',
- 'Your Telegram account is not authorized yet,',
- 'you must supply the code that Telegram sent to your phone',
- 'or another client that is currently connected',
- 'use /msg {} code <code>'.format(self.service_user.irc_nick),
- 'e.g. /msg {} code 12345'.format(self.service_user.irc_nick),
- ):
+ for line in self.service.auth_help():
hunk ./service.py 34
+ )
+
+ def auth_help(self):
+ return (
+ '----',
+ 'Your Telegram account is not authorized yet,',
+ 'you must supply the code that Telegram sent to your phone',
+ 'or another client that is currently connected',
+ 'use /msg {} code <code>'.format(self.irc.service_user.irc_nick),
+ 'e.g. /msg {} code 12345'.format(self.irc.service_user.irc_nick)
patch abf2b7ea17e019e9d6933da27c16e614eddbb8f7
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sun Jul 12 00:09:26 CEST 2026
* Update Telethon URL in README
hunk ./README.md 137
-[Telethon]: https://github.com/LonamiWebs/Telethon
+[Telethon]: https://codeberg.org/Lonami/Telethon
patch 26fc7b94f1d10c6528a0de866eed28a552c31a36
Author: E. Bosch <presidev@AT@gmail.com>
Date: Fri Jul 10 23:47:21 CEST 2026
* Fix line break in README
hunk ./README.md 128
-Copyright (c) 2020-2026 E. Bosch <presidev@AT@gmail.com>
+Copyright (c) 2020-2026 E. Bosch <presidev@AT@gmail.com> [_$_]
patch 96f3cc24071c7b58c1647b1996dac3fee46eb367
Author: E. Bosch <presidev@AT@gmail.com>
Date: Fri Jul 10 22:56:40 CEST 2026
* Update year in copyright notices
hunk ./irc.py 5
-# Copyright (c) 2020-2024 E. Bosch <presidev@AT@gmail.com>
+# Copyright (c) 2020-2024,2026 E. Bosch <presidev@AT@gmail.com>
hunk ./irgramd 6
-# Copyright (c) 2020-2024 E. Bosch <presidev@AT@gmail.com>
+# Copyright (c) 2020-2024,2026 E. Bosch <presidev@AT@gmail.com>
patch 664aa2ec859e448f7dfdfc722f364f066f559708
Author: E. Bosch <presidev@AT@gmail.com>
Date: Thu Jul 9 22:15:58 CEST 2026
* Add "initial_help" option (by default True) to enable or disable initial help message from TelegramServ
This closes issue #4 on github
hunk ./irc.py 442
- await self.send_help(user)
+ if self.conf['initial_help']:
+ await self.send_help(user)
hunk ./irgramd 92
+ tornado.options.define('initial_help', default=True, help='Enable/disable initial help message from service user [TelegramServ]')