#Optional `commands.Param` Parameter
1 messages · Page 1 of 1 (latest)
If you look at the docs, the default kwarg is chosen if no information is supplied by the user, ie its optional
disnake.ext.commands.Param(default=Ellipsis, *, name=None, description=None, choices=None, converter=None, convert_defaults=False, autocomplete=None, channel_types=None, lt=None, ...)```
A special function that creates an instance of [`ParamInfo`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.ParamInfo "disnake.ext.commands.ParamInfo") that contains some information about a slash command option. This instance should be assigned to a parameter of a function representing your slash command.
See [Parameters](https://docs.disnake.dev/en/latest/ext/commands/slash_commands.html#param-syntax) for more info.
Cmd.default(line)```
Method called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns.
If you are not using Param's you can also just assign a default value in the function declaration
like
def some_cmd(inter, optional = None):
pass
random.choices(population, weights=None, *, cum_weights=None, k=1)```
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises [`IndexError`](https://docs.python.org/library/exceptions.html#IndexError "IndexError").
If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum\_weights* sequence is given, the selections are made according to the cumulative weights (perhaps computed using [`itertools.accumulate()`](https://docs.python.org/library/itertools.html#itertools.accumulate "itertools.accumulate")). For example, the relative weights `[10, 5, 30, 5]` are equivalent to the cumulative weights `[10, 15, 45, 50]`. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work.
You don't need to use Param for choices tho
Yes, you don't need to user Param to get a choices parameter in slash commands
I already answered you bro
Show code
Yes. Ofc you did not set the default kwarg
@bot.slash_command(name='commands', description='View a list of all Sukidi commands.')
async def _commands(ctx, commandname=commands.Param(default = None, choices=["about", "billing"])):
await ctx.send('The `/commands` command is not available at this time. Please try again later.', ephemeral=True)
