Browse Source

Thanks button: Post reactions to Telegram

FREEZE-blogpost-2021-01-20
Felix 6 months ago
parent
commit
8edf5f1b78
  1. 8
      isso/ext/notifications.py

8
isso/ext/notifications.py

@ -217,6 +217,9 @@ class Telegram(object):
yield "comments.edit", self._edit_comment
yield "comments.delete", self._delete_comment
yield "reactions.new:new-thread", self._new_thread
yield "reactions.new:finish", self._new_reaction
def _sanitize(self, message):
# Need to strip elements Telegram hates
# See https://core.telegram.org/bots/api#html-style
@ -270,6 +273,11 @@ class Telegram(object):
def _delete_comment(self, id):
self._post_tg("Comment deleted: {}".format(id))
def _new_reaction(self, thread, rv):
# Note: Requires using full URLs instead of relative ones
msg = 'New reaction! {count} thanks for\n<a href="https://{uri}">{uri}</a>'
self._post_tg(msg.format(count=rv['count'], uri=thread['uri']))
class Stdout(object):

Loading…
Cancel
Save