Skip to content

Commit b4cb63d

Browse files
authored
Merge pull request #232 from artem30801/artem30801-fix-url-buttons-context
Fix URL buttons context processing Fix Docs
2 parents 83937fe + 3f08189 commit b4cb63d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

discord_slash/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,9 @@ def add_component_callback(
908908
:param Coroutine callback: The coroutine to be called when the component is interacted with. Must accept a single argument with the type :class:`.context.ComponentContext`.
909909
:param messages: If specified, only interactions from the message given will be accepted. Can be a message object to check for, or the message ID or list of previous two. Empty list will mean that no interactions are accepted.
910910
:type messages: Union[discord.Message, int, list]
911-
:param components: If specified, only interactions with ``custom_id``s of given components will be accepted. Defaults to the name of ``callback`` if ``use_callback_name=True``. Can be a custom ID (str) or component dict (actionrow or button) or list of previous two.
911+
:param components: If specified, only interactions with ``custom_id`` of given components will be accepted. Defaults to the name of ``callback`` if ``use_callback_name=True``. Can be a custom ID (str) or component dict (actionrow or button) or list of previous two.
912912
:type components: Union[str, dict, list]
913-
:param use_callback_name: Whether the ``custom_id`` defaults to the name of ``callback`` if unspecified. If ``False``, either `messages`` or ``components`` must be specified.
913+
:param use_callback_name: Whether the ``custom_id`` defaults to the name of ``callback`` if unspecified. If ``False``, either ``messages`` or ``components`` must be specified.
914914
:type use_callback_name: bool
915915
:param component_type: The type of the component to avoid collisions with other component types. See :class:`.model.ComponentType`.
916916
:type component_type: Optional[int]
@@ -961,14 +961,14 @@ def extend_component_callback(
961961
custom_id: str = None,
962962
):
963963
"""
964-
Registers existing callback object (:class:`.model.ComponentType`)
964+
Registers existing callback object (:class:`.model.ComponentCallbackObject`)
965965
for specific combination of message_id, custom_id, component_type.
966966
967967
:param callback_obj: callback object.
968968
:type callback_obj: model.ComponentCallbackObject
969969
:param message_id: If specified, only removes the callback for the specific message ID.
970970
:type message_id: Optional[.model]
971-
:param custom_id: The `custom_id` of the component.
971+
:param custom_id: The ``custom_id`` of the component.
972972
:type custom_id: Optional[str]
973973
:raises: .error.DuplicateCustomID, .error.IncorrectFormat
974974
"""
@@ -988,7 +988,7 @@ def get_component_callback(
988988
989989
:param message_id: If specified, only removes the callback for the specific message ID.
990990
:type message_id: Optional[.model]
991-
:param custom_id: The `custom_id` of the component.
991+
:param custom_id: The ``custom_id`` of the component.
992992
:type custom_id: Optional[str]
993993
:param component_type: The type of the component. See :class:`.model.ComponentType`.
994994
:type component_type: Optional[int]
@@ -1014,7 +1014,7 @@ def remove_component_callback(
10141014
10151015
:param message_id: If specified, only removes the callback for the specific message ID.
10161016
:type message_id: Optional[int]
1017-
:param custom_id: The `custom_id` of the component.
1017+
:param custom_id: The ``custom_id`` of the component.
10181018
:type custom_id: Optional[str]
10191019
:param component_type: The type of the component. See :class:`.model.ComponentType`.
10201020
:type component_type: Optional[int]
@@ -1067,9 +1067,9 @@ def component_callback(
10671067
10681068
:param messages: If specified, only interactions from the message given will be accepted. Can be a message object to check for, or the message ID or list of previous two. Empty list will mean that no interactions are accepted.
10691069
:type messages: Union[discord.Message, int, list]
1070-
:param components: If specified, only interactions with ``custom_id``s of given components will be accepted. Defaults to the name of ``callback`` if ``use_callback_name=True``. Can be a custom ID (str) or component dict (actionrow or button) or list of previous two.
1070+
:param components: If specified, only interactions with ``custom_id`` of given components will be accepted. Defaults to the name of ``callback`` if ``use_callback_name=True``. Can be a custom ID (str) or component dict (actionrow or button) or list of previous two.
10711071
:type components: Union[str, dict, list]
1072-
:param use_callback_name: Whether the ``custom_id`` defaults to the name of ``callback`` if unspecified. If ``False``, either `messages`` or ``components`` must be specified.
1072+
:param use_callback_name: Whether the ``custom_id`` defaults to the name of ``callback`` if unspecified. If ``False``, either ``messages`` or ``components`` must be specified.
10731073
:type use_callback_name: bool
10741074
:param component_type: The type of the component to avoid collisions with other component types. See :class:`.model.ComponentType`.
10751075
:type component_type: Optional[int]

discord_slash/cog_ext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ def cog_component(
190190
191191
:param messages: If specified, only interactions from the message given will be accepted. Can be a message object to check for, or the message ID or list of previous two. Empty list will mean that no interactions are accepted.
192192
:type messages: Union[discord.Message, int, list]
193-
:param components: If specified, only interactions with ``custom_id``s of given components will be accepted. Defaults to the name of ``callback`` if ``use_callback_name=True``. Can be a custom ID (str) or component dict (actionrow or button) or list of previous two.
193+
:param components: If specified, only interactions with ``custom_id`` of given components will be accepted. Defaults to the name of ``callback`` if ``use_callback_name=True``. Can be a custom ID (str) or component dict (actionrow or button) or list of previous two.
194194
:type components: Union[str, dict, list]
195-
:param use_callback_name: Whether the ``custom_id`` defaults to the name of ``callback`` if unspecified. If ``False``, either `messages`` or ``components`` must be specified.
195+
:param use_callback_name: Whether the ``custom_id`` defaults to the name of ``callback`` if unspecified. If ``False``, either ``messages`` or ``components`` must be specified.
196196
:type use_callback_name: bool
197197
:param component_type: The type of the component to avoid collisions with other component types. See :class:`.model.ComponentType`.
198198
:type component_type: Optional[int]

discord_slash/dpy_overrides.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def get_component(self, custom_id: int) -> typing.Optional[dict]:
2323
"""
2424
for row in self.components:
2525
for component in row["components"]:
26-
if component["custom_id"] == custom_id:
26+
if "custom_id" in component and component["custom_id"] == custom_id:
2727
return component
2828

2929

0 commit comments

Comments
 (0)