mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 17:36:15 +00:00
Change View.children to be a property
This allows users to call remove_item in a loop. Likewise, it prevents the footgun of doing children.append(...) which does not uphold the invariants with the weight system.
This commit is contained in:
@ -89,8 +89,6 @@ class Modal(View):
|
||||
------------
|
||||
title: :class:`str`
|
||||
The title of the modal.
|
||||
children: List[:class:`Item`]
|
||||
The list of children attached to this view.
|
||||
custom_id: :class:`str`
|
||||
The ID of the modal that gets received during an interaction.
|
||||
"""
|
||||
@ -172,7 +170,7 @@ class Modal(View):
|
||||
if component['type'] == 1:
|
||||
self._refresh(component['components'])
|
||||
else:
|
||||
item = find(lambda i: i.custom_id == component['custom_id'], self.children) # type: ignore
|
||||
item = find(lambda i: i.custom_id == component['custom_id'], self._children) # type: ignore
|
||||
if item is None:
|
||||
_log.debug("Modal interaction referencing unknown item custom_id %s. Discarding", component['custom_id'])
|
||||
continue
|
||||
|
Reference in New Issue
Block a user