Thanks button: Post reactions to Telegram

This commit is contained in:
Felix 2021-01-20 17:18:12 +01:00
parent 0f59b1b485
commit 8edf5f1b78
1 changed files with 8 additions and 0 deletions

View File

@ -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):