Passed
Pull Request — main (#321)
by
unknown
02:02
created

ActionRow.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 2
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 typing import TYPE_CHECKING
7
8
from ...objects.message.component import MessageComponent
9
10
from ...utils.api_object import APIObject
11
if TYPE_CHECKING:
12
    from typing import Dict
13
14
15
class ActionRow(APIObject):
16
    """Represents an Action Row
17
18
    Parameters
19
    ----------
20
    \\*components : :class:`~pincer.objects.message.component.MessageComponent`
21
        :class:`~pincer.objects.message.component.MessageComponent`,
22
        :class:`~pincer.objects.message.button.Button`, or
23
        :class:`~pincer.objects.message.select_menu.SelectMenu`
24
    """
25
26
    def __init__(self, *components: MessageComponent):
27
        self.components = components
28
29
    def to_dict(self) -> Dict:
30
        return {
31
            "type": 1,
32
            "components": [component.to_dict() for component in self.components]
33
        }
34