telegram, irc: Add conversion of mentions for self @username as well as
patch 7300fb2b6fde17386971ea497343afae8526fb4c
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sat Jun 10 22:31:22 CEST 2023
* telegram, irc: Add conversion of mentions for self @username as well as
other mentions in self messages [saved messages]
hunk ./irc.py 471
+ # replace self @username and other mentions for self messages sent by this instance of irgramd
+ msg = self.tg.replace_mentions(msg, user.irc_nick)
+
hunk ./telegram.py 398
- def replace_mentions(self, text):
- def repl_mentioned(text):
+ def replace_mentions(self, text, me_nick=''):
+ def repl_mentioned(text, me_nick):
hunk ./telegram.py 402
+ if me_nick and part == self.tg_username:
+ return replacement(me_nick)
hunk ./telegram.py 405
- return '{}{}{}'.format('~', self.irc.users[part].irc_nick, '~')
+ return replacement(self.irc.users[part].irc_nick)
hunk ./telegram.py 408
+ def replacement(nick):
+ return '{}{}{}'.format('~',nick, '~')
+
hunk ./telegram.py 413
- words_replaced = [repl_mentioned(elem) for elem in words]
+ words_replaced = [repl_mentioned(elem, me_nick) for elem in words]