Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1269.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow passing autocompleters that take a :class:`commands.Cog` as first argument to :class:`commands.Param`.
6 changes: 5 additions & 1 deletion disnake/ext/commands/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,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 []
Expand Down Expand Up @@ -1122,7 +1126,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,
Expand Down
Loading