Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 823fdfe

Browse files
committed
fixed KeyError: 'custom_id
1 parent bb77664 commit 823fdfe

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

discord_ui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@
4747

4848

4949
__title__ = "discord-ui"
50-
__version__ = "5.1.3"
50+
__version__ = "5.1.4"
5151
__author__ = "404kuso, RedstoneZockt"

discord_ui/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,6 @@ async def _on_component_response(self, msg):
752752
self._discord.dispatch("component", ComponentContext(self._discord._connection, data, user, msg))
753753

754754

755-
# Handle auto_defer
756755
if int(data["data"]["component_type"]) == 2:
757756
for x in msg.components.buttons:
758757
if hasattr(x, 'custom_id') and x.custom_id == data["data"]["custom_id"]:
@@ -761,6 +760,7 @@ async def _on_component_response(self, msg):
761760
for x in msg.components.selects:
762761
if x.custom_id == data["data"]["custom_id"]:
763762
component = SelectInteraction(data, user, x, msg, self._discord)
763+
# Handle auto_defer
764764
component._handle_auto_defer(self.auto_defer)
765765

766766

discord_ui/receive.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ class SelectInteraction(Interaction):
339339
"""An interaction that was created by a :class:`~SelectMenu`"""
340340
def __init__(self, data, user, s, msg, client) -> None:
341341
Interaction.__init__(self, client._connection, data, user, msg)
342-
343342
self.component: SelectMenu = s
344343
self.bot: commands.Bot = client
344+
self.custom_id: str = data['data']['custom_id']
345345
self.selected_options: List[SelectOption] = []
346346
"""The list of the selected options"""
347347
self.selected_values: List[str] = []
@@ -375,7 +375,6 @@ class SlashInteraction(Interaction):
375375
"""An interaction created by a :class:`~SlashCommand`"""
376376
def __init__(self, client, command: SlashCommand, data, user, args = None) -> None:
377377
Interaction.__init__(self, client._connection, data, user)
378-
self.custom_id: str = data['data']['custom_id']
379378
self.command: SlashCommand = command
380379
"""The original command instance that was used. If you change things here, the changes will be applied globally"""
381380
self.bot: commands.Bot = client

0 commit comments

Comments
 (0)