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. All fields are optional.
.. versionchanged:: 1.4
Can now pass ``int`` to ``colour`` keyword-only parameter.
Parameters Parameters
----------- -----------
name: :class:`str` name: :class:`str`
The new role name to change to. The new role name to change to.
permissions: :class:`Permissions` permissions: :class:`Permissions`
The new permissions to change to. 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) The new colour to change to. (aliased to color as well)
hoist: :class:`bool` hoist: :class:`bool`
Indicates if the role should be shown separately in the member list. Indicates if the role should be shown separately in the member list.
@ -258,6 +261,9 @@ class Role(Hashable):
except KeyError: except KeyError:
colour = fields.get('color', self.colour) colour = fields.get('color', self.colour)
if isinstance(colour, int):
colour = Colour(value=colour)
payload = { payload = {
'name': fields.get('name', self.name), 'name': fields.get('name', self.name),
'permissions': fields.get('permissions', self.permissions).value, 'permissions': fields.get('permissions', self.permissions).value,

Loading…
Cancel
Save