diff options
| author | Myst(MysterialPy) <[email protected]> | 2019-02-08 18:05:01 +1000 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-02-14 20:21:09 -0500 |
| commit | 806295a1be2cfb0ebc8659aa9abb605bd59ff3b6 (patch) | |
| tree | f1f7f8a7fbd50d8741bf364a36aa409135ac3ba2 | |
| parent | [commands] Add more i18n properties for HelpFormatter (diff) | |
| download | discord.py-806295a1be2cfb0ebc8659aa9abb605bd59ff3b6.tar.xz discord.py-806295a1be2cfb0ebc8659aa9abb605bd59ff3b6.zip | |
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.
| -rw-r--r-- | discord/reaction.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/discord/reaction.py b/discord/reaction.py index 03b6b215..6edd29a6 100644 --- a/discord/reaction.py +++ b/discord/reaction.py @@ -93,6 +93,34 @@ class Reaction: def __repr__(self): return '<Reaction emoji={0.emoji!r} me={0.me} count={0.count}>'.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. |