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

pincer.objects.app.select_menu   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 24
dl 0
loc 81
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 typing import List, TYPE_CHECKING
8
9
from ..message.emoji import Emoji
10
from ...utils import APIObject, MISSING
11
12
if TYPE_CHECKING:
13
    from ...utils import APINullable
14
15
16
@dataclass
17
class SelectOption(APIObject):
18
    """
19
    Represents a Discord Select Option object
20
21
    :param label:
22
        the user-facing name of the option, max 100 characters
23
24
    :param value:
25
        the def-defined value of the option, max 100 characters
26
27
    :param description:
28
        an additional description of the option, max 100 characters
29
30
    :param emoji:
31
        `id`, `name`, and `animated`
32
33
    :param default:
34
        will render this option as selected by default
35
    """
36
    label: str
37
    value: str
38
    description: APINullable[str] = MISSING
0 ignored issues
show
introduced by
The variable APINullable does not seem to be defined in case TYPE_CHECKING on line 12 is False. Are you sure this can never be the case?
Loading history...
39
    emoji: APINullable[Emoji] = MISSING
40
    default: APINullable[bool] = MISSING
41
42
43
@dataclass
44
class SelectMenu(APIObject):
45
    """
46
    Represents a Discord Select Menu object
47
48
    :param type:
49
        `3` for a select menu
50
51
    :param custom_id:
52
        a developer-defined identifier for the button,
53
        max 100 characters
54
55
    :param options:
56
        the choices in the select, max 25
57
58
    :param placeholder:
59
        custom placeholder text if nothing is selected,
60
        max 100 characters
61
62
    :param min_values:
63
        the minimum number of items that must be chosen;
64
        default 1, min 0, max 25
65
66
    :param max_values:
67
        the maximum number of items that can be chosen;
68
         default 1, max 25
69
70
    :param disabled:
71
        disable the select, default False
72
    """
73
    type: int
74
    custom_id: str
75
    options: List[SelectOption]
76
77
    placeholder: APINullable[str] = MISSING
0 ignored issues
show
introduced by
The variable APINullable does not seem to be defined in case TYPE_CHECKING on line 12 is False. Are you sure this can never be the case?
Loading history...
78
    min_values: APINullable[int] = 1
79
    max_values: APINullable[int] = 1
80
    disabled: APINullable[bool] = False
81