patch 0cfc7e59b24fb1a1b279fc593f8d04d0648e3880 Author: E. Bosch Date: Mon Oct 21 00:54:16 CEST 2024 * README update patch abf1d31ddcf3cddd55844900065a3c3dd6bf9c67 Author: E. Bosch Date: Sun Oct 20 02:32:44 CEST 2024 * exclam: Add "-" parameter to "!react" to remove a reaction patch 5c1687a16a1e49af7b5f70e9449c447bbf7c9df9 Author: E. Bosch Date: Sat Oct 19 22:56:31 CEST 2024 * telegram: On emoticon->emoji conversions for reactions, when several emoticons can be mapped to an emoji, keep first elements that are more probable allowed for reactions patch 7db9d9a07af099b00a32a6ee0197c400a52240e5 Author: E. Bosch Date: Sun Oct 13 23:00:24 CEST 2024 * telegram: Limit text length for reactions to twice as replies diff -rN -u old-irgramd/README.md new-irgramd/README.md --- old-irgramd/README.md 2024-10-23 02:32:47.883329173 +0200 +++ new-irgramd/README.md 2024-10-23 02:32:47.887329166 +0200 @@ -50,7 +50,7 @@ - Forwards (receive, send) - Deletions (receive, do) - Editions (receive, do) -- Reactions (receive, send) +- Reactions (receive, send, remove) - Polls (receive, show) - Actions [pin message, channel photo] (receive) - Dialogs management diff -rN -u old-irgramd/emoji2emoticon.py new-irgramd/emoji2emoticon.py --- old-irgramd/emoji2emoticon.py 2024-10-23 02:32:47.883329173 +0200 +++ new-irgramd/emoji2emoticon.py 2024-10-23 02:32:47.887329166 +0200 @@ -89,8 +89,8 @@ '\U0001f970': '":)e>"', } -emo_inv = {} -for k in emo: +emo_inv = { '-': None } +for k in reversed(emo): emo_inv[emo[k][1:-1]] = k def replace_mult(line, emo): diff -rN -u old-irgramd/exclam.py new-irgramd/exclam.py --- old-irgramd/exclam.py 2024-10-23 02:32:47.883329173 +0200 +++ new-irgramd/exclam.py 2024-10-23 02:32:47.887329166 +0200 @@ -199,7 +199,7 @@ if chk_msg is not None: if act in emo_inv: utf8_emo = emo_inv[act] - reaction = [ tgty.ReactionEmoji(emoticon=utf8_emo) ] + reaction = [ tgty.ReactionEmoji(emoticon=utf8_emo) ] if utf8_emo else None try: update = await self.tg.telegram_client(SendReactionRequest(self.tmp_telegram_id, id, reaction=reaction)) except ReactionInvalidError: @@ -216,8 +216,9 @@ if help == HELP.desc: # rest of HELP.desc reply += \ ( - ' !react ', + ' !react |-', 'React with to a message with ,', 'irgramd will translate emoticon to closest emoji.', + 'Use - to remove a previous reaction.', ) return reply diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py --- old-irgramd/telegram.py 2024-10-23 02:32:47.883329173 +0200 +++ new-irgramd/telegram.py 2024-10-23 02:32:47.887329166 +0200 @@ -505,8 +505,9 @@ self.sorted_len_usernames.sort(key=lambda k: len(k), reverse=True) def format_reaction(self, msg, message_rendered, edition_case, reaction): - if len(message_rendered) > self.quote_len and not msg.is_reply: - text_old = '{}...'.format(message_rendered[:self.quote_len]) + react_quote_len = self.quote_len * 2 + if len(message_rendered) > react_quote_len: + text_old = '{}...'.format(message_rendered[:react_quote_len]) text_old = fix_braces(text_old) else: text_old = message_rendered