Allow runtime modification of timeout expiry at runtime

This is done through setting View.timeout while it's running
This commit is contained in:
Rapptz
2022-03-31 01:31:26 -04:00
parent e80be19c4d
commit b4fbb08818
2 changed files with 25 additions and 10 deletions

View File

@ -88,9 +88,6 @@ class Modal(View):
Attributes
------------
timeout: Optional[:class:`float`]
Timeout from last interaction with the UI before no longer accepting input.
If ``None`` then there is no timeout.
title: :class:`str`
The title of the modal.
children: List[:class:`Item`]
@ -184,9 +181,7 @@ class Modal(View):
async def _scheduled_task(self, interaction: Interaction):
try:
if self.timeout:
self.__timeout_expiry = time.monotonic() + self.timeout
self._refresh_timeout()
allow = await self.interaction_check(interaction)
if not allow:
return