Browse Source

allow passing color int to role.edit

pull/4088/head
Anurag Singh 5 years ago
committed by Rapptz
parent
commit
5769511779
  1. 8
      discord/role.py

8
discord/role.py

@ -219,13 +219,16 @@ class Role(Hashable):
All fields are optional.
.. versionchanged:: 1.4
Can now pass ``int`` to ``colour`` keyword-only parameter.
Parameters
-----------
name: :class:`str`
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.
@ -258,6 +261,9 @@ class Role(Hashable):
except KeyError:
colour = fields.get('color', self.colour)
if isinstance(colour, int):
colour = Colour(value=colour)
payload = {
'name': fields.get('name', self.name),
'permissions': fields.get('permissions', self.permissions).value,

Loading…
Cancel
Save