patch 4f4de75d90e58e3985a7cbd8f6aad6ace683a406 Author: E. Bosch Date: Sat Apr 29 23:02:02 CEST 2023 * telegram: Add conversion of UTF-8 emojis to ASCII emoticons for all messages (not only reactions) diff -rN -u old-irgramd/emoji2emoticon.py new-irgramd/emoji2emoticon.py --- old-irgramd/emoji2emoticon.py 2024-11-22 20:56:14.274640217 +0100 +++ new-irgramd/emoji2emoticon.py 2024-11-22 20:56:14.278640211 +0100 @@ -86,3 +86,9 @@ '\U0001f644': '"o o,"', '\U0001f970': '":)e>"' } + +def replace_mult(line, emo): + for utf_emo in emo: + if utf_emo in line: + line = line.replace(utf_emo, emo[utf_emo]) + return line diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py --- old-irgramd/telegram.py 2024-11-22 20:56:14.274640217 +0100 +++ new-irgramd/telegram.py 2024-11-22 20:56:14.278640211 +0100 @@ -361,7 +361,7 @@ id = event.message.id mid = self.mid.num_to_id_offset(id) fmid = '[{}]'.format(mid) - message = event.message.message + message = e.replace_mult(event.message.message, e.emo) message_rendered = await self.render_text(event, mid, upd_to_webpend=None) edition_case, reaction = await self.edition_case(event.message) @@ -369,7 +369,7 @@ action = 'Edited' user = self.get_irc_user_from_telegram(event.sender_id) if id in self.cache: - t = self.cache[id]['text'] + t = e.replace_mult(self.cache[id]['text'], e.emo) rt = self.cache[id]['rendered_text'] ht, is_ht = get_highlighted(t, message) @@ -465,6 +465,7 @@ refwd_text = '' message = '[{}] {}{}'.format(mid, refwd_text, text) + message = e.replace_mult(message, e.emo) return message async def relay_telegram_message(self, event, user, message, channel=None):