diff options
| author | PikalaxALT <[email protected]> | 2018-07-19 17:12:24 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-08-22 21:06:09 -0400 |
| commit | 0e6082c57d9139dbba6e998c147b34cae5018e78 (patch) | |
| tree | cd22759ec8bc84af7d0df9ed678536327c4b1590 /discord/guild.py | |
| parent | Add python_requires (diff) | |
| download | discord.py-0e6082c57d9139dbba6e998c147b34cae5018e78.tar.xz discord.py-0e6082c57d9139dbba6e998c147b34cae5018e78.zip | |
Implement roles kwarg for guild.create_custom_emoji and emoji.edit
Diffstat (limited to 'discord/guild.py')
| -rw-r--r-- | discord/guild.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/discord/guild.py b/discord/guild.py index 8f770b19..46621e83 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -986,7 +986,7 @@ class Guild(Hashable): return result - async def create_custom_emoji(self, *, name, image, reason=None): + async def create_custom_emoji(self, *, name, image, roles=None, reason=None): """|coro| Creates a custom :class:`Emoji` for the guild. @@ -1005,6 +1005,8 @@ class Guild(Hashable): image: bytes The *bytes-like* object representing the image data to use. Only JPG and PNG images are supported. + roles: Optional[list[:class:`Role`]] + A :class:`list` of :class:`Role`s that can use this emoji. Leave empty to make it available to everyone. reason: Optional[str] The reason for creating this emoji. Shows up on the audit log. @@ -1022,7 +1024,9 @@ class Guild(Hashable): """ img = utils._bytes_to_base64_data(image) - data = await self._state.http.create_custom_emoji(self.id, name, img, reason=reason) + if roles: + roles = [role.id for role in roles] + data = await self._state.http.create_custom_emoji(self.id, name, img, roles=roles, reason=reason) return self._state.store_emoji(self, data) async def create_role(self, *, reason=None, **fields): |