Total Complexity | 2 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
|
|||
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 |