mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-18 12:04:54 +00:00
Fix KeyError on custom_id for modal components that don't support it
This commit is contained in:
@@ -175,9 +175,13 @@ class Modal(BaseView):
|
|||||||
elif component['type'] == 18:
|
elif component['type'] == 18:
|
||||||
self._refresh(interaction, [component['component']])
|
self._refresh(interaction, [component['component']])
|
||||||
else:
|
else:
|
||||||
item = find(lambda i: getattr(i, 'custom_id', None) == component['custom_id'], self.walk_children()) # type: ignore
|
custom_id = component.get('custom_id')
|
||||||
|
if custom_id is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
item = find(lambda i: getattr(i, 'custom_id', None) == custom_id, self.walk_children())
|
||||||
if item is None:
|
if item is None:
|
||||||
_log.debug('Modal interaction referencing unknown item custom_id %s. Discarding', component['custom_id'])
|
_log.debug('Modal interaction referencing unknown item custom_id %s. Discarding', custom_id)
|
||||||
continue
|
continue
|
||||||
item._refresh_state(interaction, component) # type: ignore
|
item._refresh_state(interaction, component) # type: ignore
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user