Skip to content

Commit 00e4856

Browse files
committed
Taskr - disable buttons on timeout
1 parent 619c61b commit 00e4856

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

taskr/components/dynamic_modal.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,17 @@ def __init__(self, title: str, field_data: dict, timeout: int = 240):
2727
self.fields[k] = field
2828

2929
async def on_submit(self, interaction: discord.Interaction):
30+
with suppress(discord.NotFound):
31+
await interaction.response.defer()
3032
self.inputs = {}
3133
for k, v in self.fields.items():
3234
self.inputs[k] = v.value
33-
with suppress(discord.NotFound):
34-
await interaction.response.defer()
3535
self.stop()
3636

3737
async def on_timeout(self) -> None:
3838
self.stop()
3939
return await super().on_timeout()
4040

4141
async def on_error(self, interaction: discord.Interaction, error: Exception, /) -> None:
42-
txt = (
43-
f"DynamicModal failed for {interaction.user.name}!\n"
44-
f"Guild: {interaction.guild}\n"
45-
f"Title: {self.title}\n"
46-
)
42+
txt = f"DynamicModal failed for {interaction.user.name}!\nGuild: {interaction.guild}\nTitle: {self.title}\n"
4743
log.error(txt, exc_info=error)

taskr/components/task_menu.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ async def on_timeout(self) -> None:
8484
self.times.disabled = True
8585
self.ai_helper.disabled = True
8686
self.run_command.disabled = True
87+
self.help.disabled = True
8788
await self.message.edit(embed=await self.get_page(), view=self)
8889
self.stop()
8990

taskr/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Taskr(Commands, commands.Cog, metaclass=CompositeMetaClass):
2626
"""Schedule bot commands with ease"""
2727

2828
__author__ = "[vertyco](https://github.com/vertyco/vrt-cogs)"
29-
__version__ = "0.0.13b"
29+
__version__ = "0.0.14b"
3030

3131
def __init__(self, bot: Red):
3232
super().__init__()

0 commit comments

Comments
 (0)