From 9728d40794f7a1178a0936adcb1e643f78f39e63 Mon Sep 17 00:00:00 2001 From: Chromosomologist Date: Fri, 3 Jan 2025 22:47:02 +0100 Subject: [PATCH] feat: allow cog-based autocompleters in commands.Param --- disnake/ext/commands/params.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/disnake/ext/commands/params.py b/disnake/ext/commands/params.py index e7df5f543d..8d896a0772 100644 --- a/disnake/ext/commands/params.py +++ b/disnake/ext/commands/params.py @@ -531,7 +531,11 @@ def __init__( self.param_name: str = self.name self.converter = converter self.convert_default = convert_default + + if autocomplete: + classify_autocompleter(autocomplete) self.autocomplete = autocomplete + self.choices = choices or [] self.type = type or str self.channel_types = channel_types or [] @@ -1121,7 +1125,7 @@ def Param( choices: Optional[Choices] = None, converter: Optional[Callable[[ApplicationCommandInteraction[BotT], Any], Any]] = None, convert_defaults: bool = False, - autocomplete: Optional[Callable[[ApplicationCommandInteraction[BotT], str], Any]] = None, + autocomplete: Optional[AnyAutocompleter] = None, channel_types: Optional[List[ChannelType]] = None, lt: Optional[float] = None, le: Optional[float] = None,