Update View timeout only if interaction_check passes

This commit is contained in:
Rapptz 2022-08-18 18:55:50 -04:00
parent 5c7f6dd37e
commit 6327402730

View File

@ -413,15 +413,15 @@ class View:
async def _scheduled_task(self, item: Item, interaction: Interaction):
try:
if self.timeout:
self.__timeout_expiry = time.monotonic() + self.timeout
item._refresh_state(interaction.data) # type: ignore
allow = await self.interaction_check(interaction)
if not allow:
return
if self.timeout:
self.__timeout_expiry = time.monotonic() + self.timeout
await item.callback(interaction)
except Exception as e:
return await self.on_error(interaction, e, item)