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

pincer.commands.components.action_row   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ActionRow.to_dict() 0 4 1
A ActionRow.__init__() 0 2 1
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