summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianhao Wang <wth@riseup.net>2024-01-11 13:49:46 +0000
committerTianhao Wang <wth@riseup.net>2024-01-11 13:49:46 +0000
commitebc18cf2aa3d486b744bceba1ae1479672b8bddd (patch)
tree2b2de85b38357669aff085d1d1e90d3ef34fa528
parent1a145c3da2e8189d0be51c773f6d003a690930fe (diff)
snippet for pleroma emoji react
-rw-r--r--api_ext.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/api_ext.py b/api_ext.py
new file mode 100644
index 0000000..15d37e2
--- /dev/null
+++ b/api_ext.py
@@ -0,0 +1,23 @@
+from mastodon.versions import _DICT_VERSION_INSTANCE, _DICT_VERSION_ACTIVITY, _DICT_VERSION_ACCOUNT, _DICT_VERSION_EMOJI, _DICT_VERSION_ANNOUNCEMENT
+from mastodon.errors import MastodonIllegalArgumentError, MastodonNotFoundError
+from mastodon.utility import api_version
+from mastodon.compat import urlparse
+
+from mastodon.internals import Mastodon as Internals
+from mastodon.types import Instance, InstanceV2, NonPaginatableList, Activity, Nodeinfo, AttribAccessDict, Rule, Announcement, CustomEmoji, Account, IdType
+
+from typing import Union, Optional
+
+class Mastodon(Internals):
+ def post_reaction_create(self, statusid: str, reaction: str):
+ """
+ Add a reaction to an announcement. `reaction` can either be a unicode emoji
+ or the name of one of the instances custom emoji.
+
+ Will throw an API error if the reaction name is not one of the allowed things
+ or when trying to add a reaction that the user has already added (adding a
+ reaction that a different user added is legal and increments the count).
+ """
+ id = self.__unpack_id(id)
+ self.__api_request('PUT', f'/api/v1/pleroma/statuses/{id}/reactions/{reaction}')
+