Maintain a reference to View dispatched tasks

This commit is contained in:
Rapptz
2025-08-14 00:39:41 -04:00
parent 3fb627d078
commit 38c6407ffd
2 changed files with 21 additions and 9 deletions

View File

@ -221,8 +221,10 @@ class Modal(View):
def _dispatch_submit(
self, interaction: Interaction, components: List[ModalSubmitComponentInteractionDataPayload]
) -> None:
asyncio.create_task(self._scheduled_task(interaction, components), name=f'discord-ui-modal-dispatch-{self.id}')
) -> asyncio.Task[None]:
return asyncio.create_task(
self._scheduled_task(interaction, components), name=f'discord-ui-modal-dispatch-{self.id}'
)
def to_dict(self) -> Dict[str, Any]:
payload = {