From 806295a1be2cfb0ebc8659aa9abb605bd59ff3b6 Mon Sep 17 00:00:00 2001 From: "Myst(MysterialPy)" Date: Fri, 8 Feb 2019 18:05:01 +1000 Subject: [PATCH] Add `remove()` to Reaction Added a coro, `remove()` which takes in a sole parameter, `member`. This new coro will remove the reaction by the provided member from the reactions message. `message.remove_reaction(reaction, member)` was not removed as to not introduce breaking changes. --- discord/reaction.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/discord/reaction.py b/discord/reaction.py index 03b6b2156..6edd29a65 100644 --- a/discord/reaction.py +++ b/discord/reaction.py @@ -93,6 +93,34 @@ class Reaction: def __repr__(self): return ''.format(self) + async def remove(self, user): + """|coro| + + Remove the reaction by the provided :class:`User` from the message. + + If the reaction is not your own (i.e. ``user`` parameter is not you) then + the :attr:`discord.permissions.Permissions.manage_messages` permission is needed. + + The ``user`` parameter must represent a user or member and meet + the :class:`abc.Snowflake` abc. + + Parameters + ----------- + user: :class:`abc.Snowflake` + The user or member from which to remove the reaction. + + Raises + ------- + HTTPException + Removing the reaction failed. + Forbidden + You do not have the proper permissions to remove the reaction. + NotFound + The user you specified, or the reaction's message was not found. + """ + + await self.message.remove_reaction(self.emoji, user) + def users(self, limit=None, after=None): """Returns an :class:`AsyncIterator` representing the users that have reacted to the message.