Implement New Select Types

Co-authored-by: Soheab_ <33902984+Soheab@users.noreply.github.com>
Co-authored-by: rdrescher909 <51489753+rdrescher909@users.noreply.github.com>
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
This commit is contained in:
Trevor
2022-10-27 10:03:45 -04:00
committed by GitHub
parent 4c8ba635db
commit 5009c83bc9
10 changed files with 698 additions and 111 deletions

View File

@ -163,21 +163,21 @@ class Modal(View):
"""
_log.error('Ignoring exception in modal %r:', self, exc_info=error)
def _refresh(self, components: Sequence[ModalSubmitComponentInteractionDataPayload]) -> None:
def _refresh(self, interaction: Interaction, components: Sequence[ModalSubmitComponentInteractionDataPayload]) -> None:
for component in components:
if component['type'] == 1:
self._refresh(component['components'])
self._refresh(interaction, component['components'])
else:
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
item._refresh_state(component) # type: ignore
item._refresh_state(interaction, component) # type: ignore
async def _scheduled_task(self, interaction: Interaction, components: List[ModalSubmitComponentInteractionDataPayload]):
try:
self._refresh_timeout()
self._refresh(components)
self._refresh(interaction, components)
allow = await self.interaction_check(interaction)
if not allow: