diff --git a/interactions/models/internal/application_commands.py b/interactions/models/internal/application_commands.py index eb3ee92bb..a06abfcee 100644 --- a/interactions/models/internal/application_commands.py +++ b/interactions/models/internal/application_commands.py @@ -1252,11 +1252,14 @@ def wrapper(func: SlashCommandT) -> SlashCommandT: return wrapper -def auto_defer(ephemeral: bool = False, time_until_defer: float = 0.0) -> Callable[[InterCommandT], InterCommandT]: +def auto_defer( + enabled: bool = True, ephemeral: bool = False, time_until_defer: float = 0.0 +) -> Callable[[InterCommandT], InterCommandT]: """ A decorator to add an auto defer to a application command. Args: + enabled: Should the command be deferred automatically ephemeral: Should the command be deferred as ephemeral time_until_defer: How long to wait before deferring automatically @@ -1265,7 +1268,7 @@ def auto_defer(ephemeral: bool = False, time_until_defer: float = 0.0) -> Callab def wrapper(func: InterCommandT) -> InterCommandT: if hasattr(func, "cmd_id"): raise ValueError("auto_defer decorators must be positioned under a slash_command decorator") - func.auto_defer = AutoDefer(enabled=True, ephemeral=ephemeral, time_until_defer=time_until_defer) + func.auto_defer = AutoDefer(enabled=enabled, ephemeral=ephemeral, time_until_defer=time_until_defer) return func return wrapper diff --git a/interactions/models/internal/extension.py b/interactions/models/internal/extension.py index 326484f97..1c0d19812 100644 --- a/interactions/models/internal/extension.py +++ b/interactions/models/internal/extension.py @@ -167,16 +167,17 @@ def drop(self) -> None: self.bot.dispatch(events.ExtensionUnload(self)) self.bot.logger.debug(f"{self.name} has been drop") - def add_ext_auto_defer(self, ephemeral: bool = False, time_until_defer: float = 0.0) -> None: + def add_ext_auto_defer(self, enabled: bool = True, ephemeral: bool = False, time_until_defer: float = 0.0) -> None: """ Add a auto defer for all commands in this extension. Args: + enabled: Should the command be deferred automatically ephemeral: Should the command be deferred as ephemeral time_until_defer: How long to wait before deferring automatically """ - self.auto_defer = models.AutoDefer(enabled=True, ephemeral=ephemeral, time_until_defer=time_until_defer) + self.auto_defer = models.AutoDefer(enabled=enabled, ephemeral=ephemeral, time_until_defer=time_until_defer) def add_ext_check(self, coroutine: Callable[["BaseContext"], Awaitable[bool]]) -> None: """