Change description to be optional when creating emoji

This commit is contained in:
n6ck
2025-11-12 03:52:54 +00:00
committed by GitHub
parent 8b15475496
commit b77459a4df

View File

@@ -26,7 +26,6 @@ from __future__ import annotations
import copy
import datetime
import unicodedata
from typing import (
Any,
AsyncIterator,
@@ -3087,7 +3086,7 @@ class Guild(Hashable):
self,
*,
name: str,
description: str,
description: str = MISSING,
emoji: str,
file: File,
reason: Optional[str] = None,
@@ -3103,11 +3102,16 @@ class Guild(Hashable):
Parameters
-----------
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`
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`
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`
The file of the sticker to upload.
reason: :class:`str`
@@ -3127,19 +3131,10 @@ class Guild(Hashable):
"""
payload = {
'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)
if self._state.cache_guild_expressions:
return self._state.store_sticker(self, data)