Skip to content

Commit

Permalink
Add a sticker type default
Browse files Browse the repository at this point in the history
  • Loading branch information
4Kaylum committed Apr 4, 2024
1 parent e030101 commit 973faeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions novus/models/sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing_extensions import Self

from ..enums import StickerFormat, StickerType
from ..utils import MISSING, cached_slot_property, try_id, try_snowflake
from .abc import Hashable
from .asset import Asset
Expand Down Expand Up @@ -102,8 +103,8 @@ def __init__(
self.pack_id: int | None = try_snowflake(data.get('pack_id'))
self.name: str = data['name']
self.description: str | None = data.get('description', None)
self.type: int = data['type']
self.format_type: int = data['format_type']
self.type: int = data.get('type', StickerType.GUILD)
self.format_type: int = data.get('format_type', StickerFormat.PNG)
self.available: bool = data.get('available', True)
self.guild = None
guild_id = data.get("guild_id")
Expand Down
8 changes: 4 additions & 4 deletions novus/payloads/sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Literal, Optional, TypedDict
from typing import TYPE_CHECKING, Optional, TypedDict

if TYPE_CHECKING:
from ._util import Snowflake
Expand All @@ -33,7 +33,7 @@
class PartialSticker(TypedDict): # Called "StickerItem" in the API
id: Snowflake
name: str
format_type: str
format_type: int


class _StickerOptional(TypedDict, total=False):
Expand All @@ -49,8 +49,8 @@ class Sticker(_StickerOptional):
name: str
description: Optional[str]
tags: str
type: Literal[1, 2]
format_type: Literal[1, 2, 3, 4]
type: int
format_type: int


class _StickerPackOptional(TypedDict, total=False):
Expand Down

0 comments on commit 973faeb

Please sign in to comment.