Completed
Push — main ( 3a3ea0...93fa25 )
by Yohann
23s queued 12s
created

pincer.objects.message.sticker   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 162
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 44
dl 0
loc 162
rs 10
c 0
b 0
f 0
1
# Copyright Pincer 2021-Present
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
from __future__ import annotations
5
6
from dataclasses import dataclass
7
from enum import IntEnum
8
from typing import List, Optional, TYPE_CHECKING
9
10
from ..user import User
11
from ...utils.api_object import APIObject
12
from ...utils.types import MISSING
13
14
if TYPE_CHECKING:
15
    from ...utils import APINullable, Snowflake
16
17
18
class StickerType(IntEnum):
19
    """
20
    Displays from where the sticker comes from.
21
22
    :param STANDARD:
23
        Sticker is included in the default Discord sticker pack.
24
25
    :param GUILD:
26
        Sticker is a custom sticker from a discord server.
27
    """
28
    STANDARD = 1
29
    GUILD = 2
30
31
32
class StickerFormatType(IntEnum):
33
    """
34
    The type of the sticker.
35
36
    :param PNG:
37
        Sticker is of PNG format.
38
39
    :param APNG:
40
        Sticker is animated with APNG format.
41
42
    :param LOTTIE:
43
        Sticker is animated with with LOTTIE format. (vector based)
44
    """
45
    PNG = 1
46
    APNG = 2
47
    LOTTIE = 3
48
49
50
@dataclass
0 ignored issues
show
best-practice introduced by
Too many instance attributes (11/7)
Loading history...
51
class Sticker(APIObject):
52
    """
53
    Represents a Discord sticker.
54
55
    :param description:
56
        description of the sticker
57
58
    :param format_type:
59
        type of sticker format
60
61
    :param id:
62
        id of the sticker
63
64
    :param name:
65
        name of the sticker
66
67
    :param tags:
68
        for guild stickers, the Discord name of a unicode emoji
69
        representing the sticker's expression. For standard stickers,
70
        a comma-separated list of related expressions.
71
72
    :param type:
73
        type of sticker
74
75
    :param available:
76
        whether this guild sticker can be used,
77
        may be false due to loss of Server Boosts
78
79
    :param guild_id:
80
        id of the guild that owns this sticker
81
82
    :param pack_id:
83
        for standard stickers, id of the pack the sticker is from
84
85
    :param sort_value:
86
        the standard sticker's sort order within its pack
87
88
    :param user:
89
        the user that uploaded the guild sticker
90
    """
91
92
    description: Optional[str]
93
    format_type: StickerFormatType
94
    id: Snowflake
0 ignored issues
show
introduced by
The variable Snowflake does not seem to be defined in case TYPE_CHECKING on line 14 is False. Are you sure this can never be the case?
Loading history...
95
    name: str
96
    tags: str
97
    type: StickerType
98
99
    available: APINullable[bool] = MISSING
0 ignored issues
show
introduced by
The variable APINullable does not seem to be defined in case TYPE_CHECKING on line 14 is False. Are you sure this can never be the case?
Loading history...
100
    guild_id: APINullable[Snowflake] = MISSING
101
    pack_id: APINullable[Snowflake] = MISSING
102
    sort_value: APINullable[int] = MISSING
103
    user: APINullable[User] = MISSING
104
105
106
@dataclass
107
class StickerItem(APIObject):
108
    """
109
    Represents the smallest amount of data required to render a sticker.
110
    A partial sticker object.
111
112
    :param id:
113
        id of the sticker
114
115
    :param name:
116
        name of the sticker
117
118
    :param format_type:
119
        type of sticker format
120
    """
121
122
    id: Snowflake
0 ignored issues
show
introduced by
The variable Snowflake does not seem to be defined in case TYPE_CHECKING on line 14 is False. Are you sure this can never be the case?
Loading history...
123
    name: str
124
    format_type: StickerFormatType
125
126
127
@dataclass
128
class StickerPack(APIObject):
129
    """
130
    Represents a pack of standard stickers.
131
132
    :param id:
133
        id of the sticker pack
134
135
    :param stickers:
136
        the stickers in the pack
137
138
    :param name:
139
        name of the sticker pack
140
141
    :param sku_id:
142
        id of the pack's SKU
143
144
    :param description:
145
        description of the sticker pack
146
147
    :param cover_sticker_id:
148
        id of a sticker in the pack which is shown as the pack's icon
149
150
    :param banner_asset_id:
151
        id of the sticker pack's banner image
152
    """
153
154
    id: Snowflake
0 ignored issues
show
introduced by
The variable Snowflake does not seem to be defined in case TYPE_CHECKING on line 14 is False. Are you sure this can never be the case?
Loading history...
155
    stickers: List[Sticker]
156
    name: str
157
    sku_id: Snowflake
158
    description: str
159
160
    cover_sticker_id: APINullable[Snowflake] = MISSING
0 ignored issues
show
introduced by
The variable APINullable does not seem to be defined in case TYPE_CHECKING on line 14 is False. Are you sure this can never be the case?
Loading history...
161
    banner_asset_id: APINullable[Snowflake] = MISSING
162