patch beacde93a685dd954f9823dc0a6fea4594b2c1e4
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sat Sep 28 02:53:06 CEST 2024
* telegram: Avoid duplicated reactions events in some cases
hunk ./telegram.py 74
+ self.last_reaction = None
hunk ./telegram.py 558
+ if self.last_reaction == reaction.date:
+ return
+ self.last_reaction = reaction.date
hunk ./telegram.py 576
- id = event.msg_id
- msg = await self.telegram_client.get_messages(entity=event.peer, ids=id)
- mid = self.mid.num_to_id_offset(msg.peer_id, id)
- message = self.filters(msg.message)
- message_rendered = await self.render_text(msg, mid, upd_to_webpend=None)
-
- text_old, edition_react, user = self.format_reaction(msg, message_rendered, edition_case='react-add', reaction=react)
-
- text = '|React {}| {}'.format(text_old, edition_react)
-
- chan = await self.relay_telegram_message(msg, user, text)
-
- self.to_cache(id, mid, message, message_rendered, user, chan, msg.media)
- self.to_volatile_cache(self.prev_id, id, text, user, chan, current_date())
+ [_$_]
+ if self.last_reaction != react.date:
+ self.last_reaction = react.date
+ id = event.msg_id
+ msg = await self.telegram_client.get_messages(entity=event.peer, ids=id)
+ mid = self.mid.num_to_id_offset(msg.peer_id, id)
+ message = self.filters(msg.message)
+ message_rendered = await self.render_text(msg, mid, upd_to_webpend=None)
+
+ text_old, edition_react, user = self.format_reaction(msg, message_rendered, edition_case='react-add', reaction=react)
+
+ text = '|React {}| {}'.format(text_old, edition_react)
+
+ chan = await self.relay_telegram_message(msg, user, text)
+
+ self.to_cache(id, mid, message, message_rendered, user, chan, msg.media)
+ self.to_volatile_cache(self.prev_id, id, text, user, chan, current_date())