Refactor modal usage and error handling in views
Replaced custom Modal class with BaseModal in embed_builder.py for consistency and maintainability. Updated modal instantiation to use custom_id and improved value handling. Removed redundant on_error methods from help.py, pagination.py, and search.py, and delegated error handling to superclass in controller.py for cleaner error management.
This commit is contained in:
@@ -484,10 +484,6 @@ class InteractiveController(discord.ui.View):
|
||||
async def on_error(self, interaction: discord.Interaction, error: Exception, item: discord.ui.Item) -> None:
|
||||
if isinstance(error, ButtonOnCooldown):
|
||||
sec = int(error.retry_after)
|
||||
await interaction.response.send_message(f"You're on cooldown for {sec} second{'' if sec == 1 else 's'}!", ephemeral=True)
|
||||
return await interaction.response.send_message(f"You're on cooldown for {sec} second{'' if sec == 1 else 's'}!", ephemeral=True)
|
||||
|
||||
elif isinstance(error, Exception):
|
||||
traceback.print_exception(error)
|
||||
await interaction.response.send_message(error)
|
||||
|
||||
return
|
||||
super().on_error(interaction, error, item)
|
||||
Reference in New Issue
Block a user