Skip to content

Commit 765ef2e

Browse files
committed
refactor: move sticker enums to enums.py
Also makes the enums value tolerant
1 parent a1a4e27 commit 765ef2e

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

interactions/models/discord/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
ScheduledEventType,
105105
StagePrivacyLevel,
106106
Status,
107+
StickerFormatType,
108+
StickerTypes,
107109
SystemChannelFlags,
108110
TeamMembershipState,
109111
UserFlags,
@@ -155,7 +157,7 @@
155157
to_snowflake_list,
156158
)
157159
from .stage_instance import StageInstance
158-
from .sticker import Sticker, StickerFormatType, StickerItem, StickerPack, StickerTypes
160+
from .sticker import Sticker, StickerItem, StickerPack
159161
from .team import Team, TeamMember
160162
from .thread import ThreadList, ThreadMember, ThreadTag
161163
from .timestamp import Timestamp, TimestampStyles

interactions/models/discord/enums.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
"ScheduledEventStatus",
4646
"AuditLogEventType",
4747
"InteractionPermissionTypes",
48+
"StickerTypes",
49+
"StickerFormatType",
4850
)
4951

5052

@@ -946,3 +948,21 @@ class MemberFlags(DiscordIntFlag):
946948
COMPLETED_ONBOARDING = 1 << 1
947949
BYPASSES_VERIFICATION = 1 << 2
948950
STARTED_ONBOARDING = 1 << 3
951+
952+
953+
class StickerTypes(CursedIntEnum):
954+
"""Types of sticker."""
955+
956+
STANDARD = 1
957+
"""An official sticker in a pack, part of Nitro or in a removed purchasable pack."""
958+
GUILD = 2
959+
"""A sticker uploaded to a Boosted guild for the guild's members."""
960+
961+
962+
class StickerFormatType(CursedIntEnum):
963+
"""File formats for stickers."""
964+
965+
PNG = 1
966+
APNG = 2
967+
LOTTIE = 3
968+
GIF = 4

interactions/models/discord/sticker.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from enum import IntEnum
21
from typing import TYPE_CHECKING, List, Optional, Union
32

43
import attrs
@@ -8,31 +7,14 @@
87
from interactions.client.utils.serializer import dict_filter_none
98
from interactions.models.discord.snowflake import to_snowflake
109
from .base import DiscordObject
10+
from interactions.models.discord.enums import StickerTypes, StickerFormatType
1111

1212
if TYPE_CHECKING:
1313
from interactions.models.discord.guild import Guild
1414
from interactions.models.discord.user import User
1515
from interactions.models.discord.snowflake import Snowflake_Type
1616

17-
__all__ = ("StickerTypes", "StickerFormatType", "StickerItem", "Sticker", "StickerPack")
18-
19-
20-
class StickerTypes(IntEnum):
21-
"""Types of sticker."""
22-
23-
STANDARD = 1
24-
"""An official sticker in a pack, part of Nitro or in a removed purchasable pack."""
25-
GUILD = 2
26-
"""A sticker uploaded to a Boosted guild for the guild's members."""
27-
28-
29-
class StickerFormatType(IntEnum):
30-
"""File formats for stickers."""
31-
32-
PNG = 1
33-
APNG = 2
34-
LOTTIE = 3
35-
GIF = 4
17+
__all__ = ("StickerItem", "Sticker", "StickerPack")
3618

3719

3820
@attrs.define(eq=False, order=False, hash=False, kw_only=False)

0 commit comments

Comments
 (0)