| Total Complexity | 2 |
| Total Lines | 36 |
| 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 ._component import _Component |
||
| 9 | from ...objects.app.command import InteractableStructure |
||
| 10 | |||
| 11 | from ...utils.api_object import APIObject |
||
| 12 | |||
| 13 | if TYPE_CHECKING: |
||
| 14 | from typing import Dict |
||
| 15 | |||
| 16 | |||
| 17 | class ActionRow(APIObject): |
||
| 18 | """Represents an Action Row |
||
| 19 | |||
| 20 | Parameters |
||
| 21 | ---------- |
||
| 22 | \\*components : :class:`~pincer.objects.message.component.MessageComponent` |
||
| 23 | :class:`~pincer.objects.message.component.MessageComponent`, |
||
| 24 | :class:`~pincer.objects.message.button.Button`, or |
||
| 25 | :class:`~pincer.objects.message.select_menu.SelectMenu` |
||
| 26 | """ |
||
| 27 | |||
| 28 | def __init__(self, *components: InteractableStructure[_Component]): |
||
| 29 | self.components = components |
||
| 30 | |||
| 31 | def to_dict(self) -> Dict: |
||
| 32 | return { |
||
| 33 | "type": 1, |
||
| 34 | "components": [ |
||
| 35 | component.metadata.to_dict() for component in self.components |
||
| 36 | ], |
||
| 38 |