mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-11-20 15:51:30 +00:00
Change description to be optional when creating emoji
This commit is contained in:
@@ -26,7 +26,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import unicodedata
|
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
AsyncIterator,
|
AsyncIterator,
|
||||||
@@ -3087,7 +3086,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
name: str,
|
name: str,
|
||||||
description: str,
|
description: str = MISSING,
|
||||||
emoji: str,
|
emoji: str,
|
||||||
file: File,
|
file: File,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
@@ -3103,11 +3102,16 @@ class Guild(Hashable):
|
|||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
name: :class:`str`
|
name: :class:`str`
|
||||||
The sticker name. Must be at least 2 characters.
|
The sticker name. Must be between 2 and 30 characters.
|
||||||
description: :class:`str`
|
description: :class:`str`
|
||||||
The sticker's description.
|
The sticker's description. Can be an empty string or a string between 2 and 100 characters.
|
||||||
|
Defaults to an empty string if not provided.
|
||||||
emoji: :class:`str`
|
emoji: :class:`str`
|
||||||
The name of a unicode emoji that represents the sticker's expression.
|
The emoji tag associated with the sticker. This corresponds to the
|
||||||
|
``tags`` field in Discord's API, which is used for emoji autocomplete
|
||||||
|
and suggestion purposes. For correct rendering in Discord's UI, this
|
||||||
|
should ideally be a raw Unicode emoji or the string ID
|
||||||
|
of a custom emoji. Any string up to 200 characters is accepted.
|
||||||
file: :class:`File`
|
file: :class:`File`
|
||||||
The file of the sticker to upload.
|
The file of the sticker to upload.
|
||||||
reason: :class:`str`
|
reason: :class:`str`
|
||||||
@@ -3127,19 +3131,10 @@ class Guild(Hashable):
|
|||||||
"""
|
"""
|
||||||
payload = {
|
payload = {
|
||||||
'name': name,
|
'name': name,
|
||||||
|
'description': description or '',
|
||||||
|
'tags': emoji,
|
||||||
}
|
}
|
||||||
|
|
||||||
payload['description'] = description
|
|
||||||
|
|
||||||
try:
|
|
||||||
emoji = unicodedata.name(emoji)
|
|
||||||
except TypeError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
emoji = emoji.replace(' ', '_')
|
|
||||||
|
|
||||||
payload['tags'] = emoji
|
|
||||||
|
|
||||||
data = await self._state.http.create_guild_sticker(self.id, payload, file, reason)
|
data = await self._state.http.create_guild_sticker(self.id, payload, file, reason)
|
||||||
if self._state.cache_guild_expressions:
|
if self._state.cache_guild_expressions:
|
||||||
return self._state.store_sticker(self, data)
|
return self._state.store_sticker(self, data)
|
||||||
|
|||||||
Reference in New Issue
Block a user