allow passing color int to role.edit

This commit is contained in:
Anurag Singh 2020-05-04 09:29:37 +05:30 committed by Rapptz
parent 1e9937a234
commit 5769511779

View File

@ -218,6 +218,9 @@ class Role(Hashable):
use this.
All fields are optional.
.. versionchanged:: 1.4
Can now pass ``int`` to ``colour`` keyword-only parameter.
Parameters
-----------
@ -225,7 +228,7 @@ class Role(Hashable):
The new role name to change to.
permissions: :class:`Permissions`
The new permissions to change to.
colour: :class:`Colour`
colour: Union[:class:`Colour`, :class:`int`]
The new colour to change to. (aliased to color as well)
hoist: :class:`bool`
Indicates if the role should be shown separately in the member list.
@ -257,6 +260,9 @@ class Role(Hashable):
colour = fields['colour']
except KeyError:
colour = fields.get('color', self.colour)
if isinstance(colour, int):
colour = Colour(value=colour)
payload = {
'name': fields.get('name', self.name),