diff options
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): |