Fix 'available' KeyError for GuildSticker

Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
This commit is contained in:
Vish M 2023-04-01 09:57:00 +01:00 committed by GitHub
parent ee9e549836
commit ab287e71b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -414,7 +414,7 @@ class GuildSticker(Sticker):
def _from_data(self, data: GuildStickerPayload) -> None:
super()._from_data(data)
self.available: bool = data['available']
self.available: bool = data.get('available', True)
self.guild_id: int = int(data['guild_id'])
user = data.get('user')
self.user: Optional[User] = self._state.store_user(user) if user else None

View File

@ -55,7 +55,7 @@ class StandardSticker(BaseSticker):
class GuildSticker(BaseSticker):
type: Literal[2]
available: bool
available: NotRequired[bool]
guild_id: Snowflake
user: NotRequired[User]