Red-DiscordBot/docs/index.rst
zephyrkul 04e97f3516 [CustomCom] Custom Command Parameters (#2051)
* [V3 CustomCom] Custom Command Parameters

Allows specifying more parameters for CC's via {0}, {1}, etc. that will be filled by the user invoking the CC. Python-style type hinting and attribute access is also allowed for Discord and builtin types.

> [p]cc add simple greet Hi, {0.mention:Member}!
> ...
> [p]greet zephyrkul
> Hi, @zephyrkul!

The bot will reply with the standard help messages if the cc is incorrectly executed.

> [p]greet me
> Member "me" not found

* black formatting

* check command failure

Only call the custom command if the faked command succeeded.

* misc fixes

1) don't str.strip all the time, it's not family-friendly and doesn't match transform_parameter
2) transform_arg now actually returns strings in every case
3) improve prepare_args parsing security
4) help parameters will show what type they expect
5) make linter less angery

* customcom documentation

I hate rst

* don't require repeated type hinting

If a parameter was type hinted previously, don't require it again.
Ex: `{0.display_name:Member}#{0.discriminator}` is now possible.

* add cog_customcom.rts to index

I despise rst

* don't enforce order

Allow type hinting and attribute access to be in either order.
Ex. `{0:Member.mention}` is now valid.

* clean up on_message

We're building context anyway, may as well use it.

* [doc] correct cog name

Cog class is named CustomCommands, not CustomCom

* minor on_message optimization

only build context if it's needed

* update cc_add docstring

Old one wasn't user-friendly. Replaced with a link to the new docs.
Link will not function until PR is merged and docs refreshed.

* [doc] change repeat to say

repeat is an audio command, use say in the example instead

* compare ctx.prefix to None

allows for null prefixes, which is a bad idea but who am I to judge

* address review

* raise error on conflicting colon notation

bugfix I was working on but failed to actually commit
2018-09-07 00:14:02 +10:00

55 lines
1.1 KiB
ReStructuredText

.. Red - Discord Bot documentation master file, created by
sphinx-quickstart on Thu Aug 10 23:18:25 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Red - Discord Bot's documentation!
=============================================
.. toctree::
:maxdepth: 1
:caption: Installation Guides:
install_windows
install_linux_mac
venv_guide
cog_dataconverter
autostart_systemd
.. toctree::
:maxdepth: 2
:caption: Cog Reference:
cog_customcom
cog_downloader
cog_permissions
.. toctree::
:maxdepth: 2
:caption: Red Development Framework Reference:
guide_migration
guide_cog_creation
guide_data_conversion
framework_bank
framework_bot
framework_cogmanager
framework_config
framework_datamanager
framework_downloader
framework_events
framework_i18n
framework_modlog
framework_commands
framework_rpc
framework_utils
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`