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

Commit

Permalink
fixed KeyError: 'custom_id
Browse files Browse the repository at this point in the history
  • Loading branch information
kvsxxx committed Dec 12, 2021
1 parent bb77664 commit 823fdfe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion discord_ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@


__title__ = "discord-ui"
__version__ = "5.1.3"
__version__ = "5.1.4"
__author__ = "404kuso, RedstoneZockt"
2 changes: 1 addition & 1 deletion discord_ui/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,6 @@ async def _on_component_response(self, msg):
self._discord.dispatch("component", ComponentContext(self._discord._connection, data, user, msg))


# Handle auto_defer
if int(data["data"]["component_type"]) == 2:
for x in msg.components.buttons:
if hasattr(x, 'custom_id') and x.custom_id == data["data"]["custom_id"]:
Expand All @@ -761,6 +760,7 @@ async def _on_component_response(self, msg):
for x in msg.components.selects:
if x.custom_id == data["data"]["custom_id"]:
component = SelectInteraction(data, user, x, msg, self._discord)
# Handle auto_defer
component._handle_auto_defer(self.auto_defer)


Expand Down
3 changes: 1 addition & 2 deletions discord_ui/receive.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ class SelectInteraction(Interaction):
"""An interaction that was created by a :class:`~SelectMenu`"""
def __init__(self, data, user, s, msg, client) -> None:
Interaction.__init__(self, client._connection, data, user, msg)

self.component: SelectMenu = s
self.bot: commands.Bot = client
self.custom_id: str = data['data']['custom_id']
self.selected_options: List[SelectOption] = []
"""The list of the selected options"""
self.selected_values: List[str] = []
Expand Down Expand Up @@ -375,7 +375,6 @@ class SlashInteraction(Interaction):
"""An interaction created by a :class:`~SlashCommand`"""
def __init__(self, client, command: SlashCommand, data, user, args = None) -> None:
Interaction.__init__(self, client._connection, data, user)
self.custom_id: str = data['data']['custom_id']
self.command: SlashCommand = command
"""The original command instance that was used. If you change things here, the changes will be applied globally"""
self.bot: commands.Bot = client
Expand Down

0 comments on commit 823fdfe

Please sign in to comment.