Browse Source
Allow `Guild.create_role` to accept an int as the `colour` parameter.
pull/6197/head
Alex Nørgaard
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
1 deletions
-
discord/guild.py
|
|
@ -1736,7 +1736,7 @@ class Guild(Hashable): |
|
|
|
The role name. Defaults to 'new role'. |
|
|
|
permissions: :class:`Permissions` |
|
|
|
The permissions to have. Defaults to no permissions. |
|
|
|
colour: :class:`Colour` |
|
|
|
colour: Union[:class:`Colour`, :class:`int`] |
|
|
|
The colour for the role. Defaults to :meth:`Colour.default`. |
|
|
|
This is aliased to ``color`` as well. |
|
|
|
hoist: :class:`bool` |
|
|
@ -1775,6 +1775,8 @@ class Guild(Hashable): |
|
|
|
except KeyError: |
|
|
|
colour = fields.get('color', Colour.default()) |
|
|
|
finally: |
|
|
|
if isinstance(colour, int): |
|
|
|
colour = Colour(value=colour) |
|
|
|
fields['color'] = colour.value |
|
|
|
|
|
|
|
valid_keys = ('name', 'permissions', 'color', 'hoist', 'mentionable') |
|
|
|