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.
This commit is contained in:
Myst(MysterialPy) 2019-02-08 18:05:01 +10:00 committed by Rapptz
parent ea0f1ee25f
commit 806295a1be

View File

@ -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.