Skip to content

Commit

Permalink
allow passing color int to role.edit
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag-7 authored and Rapptz committed May 10, 2020
1 parent 1e9937a commit 5769511
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion discord/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,17 @@ async def edit(self, *, reason=None, **fields):
use this.
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.
Expand Down Expand Up @@ -257,6 +260,9 @@ async def edit(self, *, reason=None, **fields):
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),
Expand Down

0 comments on commit 5769511

Please sign in to comment.