diff --git a/CHANGES.rst b/CHANGES.rst index bc48f4ff7..f5a484590 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -45,6 +45,7 @@ fixes: - chore: bump docker/setup-qemu-action version (#1761) - docs: add command parameter section and minor doc edits (#1740) - chore: bump actions/upload-artifact version (#1762) +- docs: add positional argument with default example (#1763) v6.2.0 (2024-01-01) diff --git a/docs/user_guide/plugin_development/botcommands.rst b/docs/user_guide/plugin_development/botcommands.rst index 9c782a6a4..d06ee768d 100644 --- a/docs/user_guide/plugin_development/botcommands.rst +++ b/docs/user_guide/plugin_development/botcommands.rst @@ -70,6 +70,7 @@ a command's arguments in `argparse format`_. The decorator can be used multiple .. note:: * An argument's `dest` parameter is used as its kwargs key when your command is called. * `favorite_number` would be `None` if we removed `default=42` from the :func:`~errbot.decorators.arg_botcmd` call. + * For **positional** arguments (those without a ``--`` prefix) to be optional and use a ``default`` value, you must also specify ``nargs='?'``. For example: ``@arg_botcmd('favorite_food', default='pizza', nargs='?')``.