Implement role icons
This commit is contained in:
@@ -2448,6 +2448,8 @@ class Guild(Hashable):
|
||||
colour: Union[Colour, int] = ...,
|
||||
hoist: bool = ...,
|
||||
mentionable: bool = ...,
|
||||
icon: bytes = ...,
|
||||
emoji: str = ...,
|
||||
) -> Role:
|
||||
...
|
||||
|
||||
@@ -2461,6 +2463,8 @@ class Guild(Hashable):
|
||||
color: Union[Colour, int] = ...,
|
||||
hoist: bool = ...,
|
||||
mentionable: bool = ...,
|
||||
icon: bytes = ...,
|
||||
emoji: str = ...,
|
||||
) -> Role:
|
||||
...
|
||||
|
||||
@@ -2473,6 +2477,8 @@ class Guild(Hashable):
|
||||
colour: Union[Colour, int] = MISSING,
|
||||
hoist: bool = MISSING,
|
||||
mentionable: bool = MISSING,
|
||||
icon: bytes = MISSING,
|
||||
emoji: str = MISSING,
|
||||
reason: Optional[str] = None,
|
||||
) -> Role:
|
||||
"""|coro|
|
||||
@@ -2502,6 +2508,10 @@ class Guild(Hashable):
|
||||
mentionable: :class:`bool`
|
||||
Indicates if the role should be mentionable by others.
|
||||
Defaults to ``False``.
|
||||
emoji: :class:`str`
|
||||
The unicode emoji that is shown next to users with the role.
|
||||
icon: :class:`bytes`
|
||||
A custom image that is shown next to users with the role.
|
||||
reason: Optional[:class:`str`]
|
||||
The reason for creating this role. Shows up on the audit log.
|
||||
|
||||
@@ -2540,6 +2550,12 @@ class Guild(Hashable):
|
||||
if name is not MISSING:
|
||||
fields["name"] = name
|
||||
|
||||
if emoji is not MISSING:
|
||||
fields["unicode_emoji"] = emoji
|
||||
|
||||
if icon is not MISSING:
|
||||
fields["icon"] = utils._bytes_to_base64_data(icon)
|
||||
|
||||
data = await self._state.http.create_role(self.id, reason=reason, **fields)
|
||||
role = Role(guild=self, data=data, state=self._state)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user