|
6 | 6 | Components
|
7 | 7 | ==========
|
8 | 8 |
|
| 9 | +.. _buttoncolor: |
| 10 | + |
| 11 | +:class:`discord.ButtonColor` |
| 12 | +============================ |
| 13 | + * ``blurple`` = 1 |
| 14 | + * ``grey`` = 2 |
| 15 | + * ``green`` = 3 |
| 16 | + * ``red`` = 4 |
| 17 | + * ``grey_url`` (navigates to an URL) = 5 |
| 18 | + |
| 19 | +.. _actionrow: |
| 20 | + |
9 | 21 | :class:`discord.ActionRow(*args, **kwargs)`
|
10 |
| -___________________________________________ |
| 22 | +=========================================== |
11 | 23 |
|
12 | 24 | Represents an ``ActionRow``-Part for the components of an :class:`discord.Message`
|
13 | 25 |
|
| 26 | +.. note:: |
| 27 | + |
| 28 | + You could use an :class:`list` instead of this but you dont have the functions and oarameters of this class then. |
| 29 | + |
| 30 | +.. _actionrow-attributes: |
| 31 | + |
14 | 32 | Attributes
|
15 | 33 | ----------
|
16 | 34 |
|
17 |
| -* :attr:`*args`: [Union[:class:`Button`, :class:`SelectionMenu`]] |
18 |
| - An array of :class:`Button`/s and/or :class:`SelectionMenu`/s. |
| 35 | + * :attr:`*args`: [Union[:class:`Button`, :class:`SelectionMenu`]] |
| 36 | + An array of :class:`Button`/s and/or :class:`SelectionMenu`/s. |
19 | 37 |
|
20 |
| -* :attr:`force`: Optional[Bool] |
21 |
| - When set to ``True`` an Empty :class:`ActionRow` will be ignored |
| 38 | + .. _actionrow-force: |
22 | 39 |
|
23 |
| -.. note:: |
24 |
| - For more information about ActionRow's visit the `Discord-API Documentation <https://discord.com/developers/docs/interactions/message-components#actionrow>`_. |
| 40 | + * :attr:`force`: Optional[Bool] |
| 41 | + When set to ``True`` an Empty :class:`ActionRow` will be ignored |
| 42 | + |
| 43 | + .. note:: |
| 44 | + For more information about ActionRow's visit the `Discord-API Documentation <https://discord.com/developers/docs/interactions/message-components#actionrow>`_. |
| 45 | + |
| 46 | +.. _actionrow-methodes: |
25 | 47 |
|
26 | 48 | Methodes
|
27 | 49 | --------
|
| 50 | + .. _actionrow-sendable: |
| 51 | + |
| 52 | + :meth:`sendable` -> Dict |
| 53 | + Makes the :class:`ActionRow` sendable to discord. |
28 | 54 |
|
29 |
| -:meth:`sendable`: Dict |
30 |
| - Makes the :class:`ActionRow` sendable to discord. |
| 55 | + .. _actionrow-disable_all_buttons: |
31 | 56 |
|
32 |
| -:meth:`disable_all_buttons()` |
33 |
| - Disable all objects's of type :class:`discord.Button` in this :class:`ActionRow`. |
| 57 | + :meth:`disable_all_buttons()` |
| 58 | + Disable all objects's of type :class:`discord.Button` in this :class:`ActionRow`. |
| 59 | + |
| 60 | + :return: :class:`discord.ActionRow` |
34 | 61 |
|
35 |
| - :return: :class:`discord.ActionRow` |
| 62 | + .. _actionrow-disable_all_buttons_if: |
36 | 63 |
|
37 |
| -:meth:`disable_all_buttons_if(check: Union[Bool, Callable], **kwargs)` |
38 |
| - Disable all :class:`discord.Button` in this :class:`ActionRow` if the passed :attr:`check` ``True``. |
| 64 | + :meth:`disable_all_buttons_if(check: Union[Bool, Callable], **kwargs)` |
| 65 | + Disable all :class:`discord.Button` in this :class:`ActionRow` if the passed :attr:`check` ``True``. |
39 | 66 |
|
40 |
| - **Parameters** |
| 67 | + **Parameters** |
41 | 68 |
|
42 |
| - * :attr:`check`: Union[Bool, Callable] |
43 |
| - could be an :class:`bool` or usually any :obj:`Callable` that returns an :class:`bool` |
44 |
| - |
45 |
| - * :attr:`**kwargs` |
46 |
| - :obj:`kwargs` that should passed in to the :attr:`check` if it is an :obj:`Callable` |
| 69 | + * :attr:`check`: Union[Bool, Callable] |
| 70 | + could be an :class:`bool` or usually any :obj:`Callable` that returns an :class:`bool` |
| 71 | + |
| 72 | + * :attr:`**kwargs` |
| 73 | + :obj:`kwargs` that should passed in to the :attr:`check` if it is an :obj:`Callable` |
47 | 74 |
|
48 |
| - :return: :class:`ActionRow` |
| 75 | + :return: :class:`ActionRow` |
| 76 | + |
| 77 | +.. _button: |
49 | 78 |
|
50 | 79 | :class:`discord.Button(**kwargs)`
|
51 |
| -_________________________________ |
| 80 | +================================= |
52 | 81 |
|
53 | 82 | Represents an ``Discord-Button``
|
54 | 83 |
|
55 | 84 | .. note::
|
56 | 85 | For more information Discord-Button's visit the `Discord-API Documentation <https://discord.com/developers/docs/interactions/message-components#buttons>`_.
|
57 |
| - |
| 86 | + |
| 87 | +.. _button-attributes: |
| 88 | + |
58 | 89 | Attributes
|
59 | 90 | ----------
|
60 | 91 |
|
61 |
| -:attr:`label`: :class:`str` |
62 |
| - The Text displayed in discord on the Button. Maximal lenght is 80 Chars. |
63 |
| -:attr:`custom_id`: Union[:class:`str`, :class:`int`] |
64 |
| - The custom_id discord send us when a User press the Button. The max. lenght of this is 100. |
65 |
| -:attr:`style`: Union[:class:`ButtonColor`, :class:`ButtonStyle`, Any[1, 2, 3, 4, 5]] |
66 |
| - The Style of the Button. |
| 92 | + .. _button-label: |
67 | 93 |
|
68 |
| - .. note:: |
69 |
| - To get more infos about the styles wisit |
70 |
| - `the Discord-API Documentation <https://discord.com/developers/docs/interactions/message-components#buttons-button-styles>`_. |
| 94 | + :attr:`label`: :class:`str` |
| 95 | + The Text displayed in discord on the Button. Maximal lenght is 80 Chars. |
| 96 | + |
| 97 | + .. _button-custom_id: |
71 | 98 |
|
72 |
| -:attr:`emoji`: Optional[Union[:class:`discord.PartialEmoji`, :class:`discord.Emoji`, :class:`str`]] |
73 |
| - The Emoji that will be displayed on the left side of the Button. |
74 |
| -:attr:`url`: Optional[:class:`str`] |
75 |
| - The url the Button includes |
| 99 | + :attr:`custom_id`: Union[:class:`str`, :class:`int`] |
| 100 | + The custom_id discord send us when a User press the Button. The max. lenght of this is 100. |
| 101 | + |
| 102 | + .. _button-style: |
76 | 103 |
|
77 |
| - .. note:: |
78 |
| - if you set this, the :attr:`style` will automaticly set to :class:`ButtonStyle.Link_Button` |
| 104 | + :attr:`style`: Union[:class:`ButtonColor`, :class:`ButtonStyle`, Any[1, 2, 3, 4, 5]] |
| 105 | + The Style of the Button. |
79 | 106 |
|
80 |
| - .. warning:: |
81 |
| - |
82 |
| - You cant pass an :attr:`custom_id` and a :attr:`url` beacuse discord dont send anything when clicking on an ``URL-Button`` so it dont accept both; :attr:`url`/ButtonStyle.Link_Button and :attr:`custom_id`! |
| 107 | + .. note:: |
| 108 | + To get more infos about the styles wisit |
| 109 | + `the Discord-API Documentation <https://discord.com/developers/docs/interactions/message-components#buttons-button-styles>`_. |
83 | 110 |
|
84 |
| -:attr:`disabled`: :class:`Bool` |
85 |
| - Whether the Button is disabled; defauld False. |
| 111 | + .. _button-emoji: |
86 | 112 |
|
| 113 | + :attr:`emoji`: Optional[Union[:class:`discord.PartialEmoji`, :class:`discord.Emoji`, :class:`str`]] |
| 114 | + The Emoji that will be displayed on the left side of the Button. |
| 115 | + |
| 116 | + .. _button-url: |
| 117 | + |
| 118 | + :attr:`url`: Optional[:class:`str`] |
| 119 | + The URL the Button links too. |
| 120 | + |
| 121 | + .. note:: |
| 122 | + if you set this, the :attr:`style` will automaticly set to :class:`ButtonStyle.Link_Button` |
| 123 | + |
| 124 | + .. warning:: |
| 125 | + |
| 126 | + You cant pass an :attr:`custom_id` and a :attr:`url` beacuse discord dont send anything when clicking on an ``URL-Button`` so it dont accept both; :attr:`url`/ButtonStyle.Link_Button and :attr:`custom_id`! |
| 127 | + |
| 128 | + .. _button-disabled: |
| 129 | + |
| 130 | + :attr:`disabled`: :class:`Bool` |
| 131 | + Whether the Button is disabled; defauld False. |
| 132 | + |
| 133 | +.. _button-methodes: |
87 | 134 |
|
88 | 135 | Methodes
|
89 | 136 | --------
|
90 | 137 |
|
91 |
| -:meth:`disable_if` |
92 |
| -Disable the :class:`Button` if the passed :attr:`check` returns ``True``. |
| 138 | + .. _button-disable_if: |
93 | 139 |
|
94 |
| - * :attr:`check`: typing.Union[bool, typing.Callable] |
95 |
| - Could be an :class:`bool` or usually any :class:`Callable` that returns an :class:`bool` |
| 140 | + :meth:`disable_if` |
| 141 | + |
| 142 | + Disable the :class:`Button` if the passed :attr:`check` returns ``True``. |
| 143 | + * :attr:`check`: typing.Union[bool, typing.Callable] |
| 144 | + Could be an :class:`bool` or usually any :class:`Callable` that returns an :class:`bool` |
| 145 | + * :attr:`**kwargs`: Any[SupportsIndex] |
| 146 | + Arguments that should passed in to the :attr:`check` if it is an :class:`Callable` |
96 | 147 |
|
97 |
| - * :attr:`**kwargs`: Any[SupportsIndex] |
98 |
| - Arguments that should passed in to the :attr:`check` if it is an :class:`Callable` |
| 148 | + :return: :class:`discord.Button` |
| 149 | + |
| 150 | + .. _button-set_color_if: |
99 | 151 |
|
100 |
| - :return: :class:`discord.Button` |
| 152 | + :meth:`set_color_if` |
101 | 153 |
|
102 |
| -:meth:`set_color_if` |
103 |
| -Sets the Color(Style) of an :class:`discord.Button` to the provided :attr:`color` if the passed :attr:`check` returns ``True``. |
104 |
| - |
105 |
| - * :attr:`check`: could be an :class:`bool` or usaly any :obj:`Callable` that returns an :class:`bool` |
| 154 | + Sets the Color(Style) of an :class:`discord.Button` to the provided :attr:`color` if the passed :attr:`check` returns ``True``. |
| 155 | + |
| 156 | + * :attr:`check`: could be an :class:`bool` or usaly any :obj:`Callable` that returns an :class:`bool` |
| 157 | + |
| 158 | + * :attr:`color`: the Color(Style) that should set if the :attr:`check` returns ``True`` |
106 | 159 |
|
107 |
| - * :attr:`color`: the Color(Style) that should set if the :attr:`check` returns ``True`` |
108 |
| - |
109 |
| - * :attr:`**kwargs`: ``kwargs`` that should passed in to the :attr:`check` if it is an :class:`Callable` |
| 160 | + * :attr:`**kwargs`: ``kwargs`` that should passed in to the :attr:`check` if it is an :class:`Callable` |
110 | 161 |
|
111 |
| - :return: :class:`discord.Button` |
| 162 | + :return: :class:`discord.Button` |
112 | 163 |
|
113 | 164 | .. toctree::
|
114 | 165 | :maxdepth: 3
|
|
0 commit comments