Add compact message ids in messages sent from IRC that are echoed to IRC,
patch e664cfbb6157d6f9eab1db5d836213317fe1c2e5
Author: E. Bosch <presidev@AT@gmail.com>
Date: Tue Apr 11 09:45:58 CEST 2023
* Add compact message ids in messages sent from IRC that are echoed to IRC,
add those messages to cache
hunk ./irc.py 387
+ defered_send = None
hunk ./irc.py 390
+ # used defered_send function when id is known
hunk ./irc.py 392
- await self.send_msg_others(user, tgl, message)
+ chan = tgl
+ defered_send = self.send_msg_others
+ defered_target = chan
+ else:
+ chan = None
hunk ./irc.py 402
- await self.send_msg(user, None, message)
+ # used defered_send function when id is known
+ defered_send = self.send_msg
+ defered_target = None
hunk ./irc.py 410
- await self.tg.telegram_client.send_message(telegram_id, message)
+ tg_msg = await self.tg.telegram_client.send_message(telegram_id, message)
+
+ text = '[{}] {}'.format(self.tg.mid.num_to_id_offset(tg_msg.id), message)
+ self.tg.add_to_cache(tg_msg.id, None, text, user, chan)
+
+ if defered_send:
+ await defered_send(user, defered_target, text)