Add "emoji_ascii" option to control if emojis are converted to ASCII emoticons
patch 0bfa5e100cf36ddf987dd40df98b4fdbaa90728f
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sat Apr 29 20:47:52 CEST 2023
* Add "emoji_ascii" option to control if emojis are converted to ASCII emoticons
diff -rN -u old-irgramd/irgramd new-irgramd/irgramd
--- old-irgramd/irgramd 2024-11-22 14:57:27.552833912 +0100
+++ new-irgramd/irgramd 2024-11-22 14:57:27.552833912 +0100
@@ -72,6 +72,7 @@
tornado.options.define('char_encoding', default='utf-8', metavar='ENCODING', help='Character encoding for IRC')
tornado.options.define('config', default='irgramdrc', metavar='CONFIGFILE', help='Config file absolute or relative to `config_dir` (command line options override it)')
tornado.options.define('config_dir', default='~/.config/irgramd', metavar='PATH', help='Configuration directory where telegram session info is saved')
+ tornado.options.define('emoji_ascii', default=False, help='Replace emoji with ASCII emoticons')
tornado.options.define('irc_address', default='127.0.0.1', metavar='ADDRESS', help='Address to listen on for IRC')
tornado.options.define('irc_nicks', type=str, multiple=True, metavar='nick,..', help='List of nicks allowed for IRC, if `pam` and optionally `pam_group` are set, PAM authentication will be used instead')
tornado.options.define('irc_password', default='', metavar='PASSWORD', help='Password for IRC authentication, if `pam` is set, PAM authentication will be used instead')
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-11-22 14:57:27.552833912 +0100
+++ new-irgramd/telegram.py 2024-11-22 14:57:27.556833906 +0100
@@ -23,7 +23,7 @@
from include import CHAN_MAX_LENGHT, NICK_MAX_LENGTH
from irc import IRCUser
from utils import sanitize_filename, is_url_equiv, extract_url, get_human_size, get_human_duration, get_highlighted, fix_braces
-from emoji2emoticon import emo
+import emoji2emoticon as e
# Test IP table
@@ -48,6 +48,8 @@
self.test_port = settings['test_port']
self.ask_code = settings['ask_code']
self.quote_len = settings['quote_length']
+ if not settings['emoji_ascii']:
+ e.emo = {}
self.media_cn = 0
self.irc = irc
self.authorized = False
@@ -397,7 +399,7 @@
user = self.get_irc_user_from_telegram(reaction.peer_id.user_id)
emoji = reaction.reaction.emoticon
react_action = '+'
- react_icon = emo[emoji] if emoji in emo else emoji
+ react_icon = e.emo[emoji] if emoji in e.emo else emoji
elif edition_case == 'react-del':
user = self.get_irc_user_from_telegram(event.sender_id)
react_action = '-'