diff --git a/doc/Commands.md b/doc/Commands.md new file mode 100644 index 00000000..60250129 --- /dev/null +++ b/doc/Commands.md @@ -0,0 +1,117 @@ + +# Commands + + + * [About](#about) + * [Advanced interpreter](#advanced-interpreter) + * [piping](#piping) + * [command substitution](#command-substitution) + * [command splitting](#command-splitting) + * [advanced $variable interpolation](#advanced-variable-interpolation) + * [inline commands](#inline-commands) + * [Types of commands](#types-of-commands) + * [Built-in commands](#built-in-commands) + * [Plugins](#plugins) + * [Factoids](#factoids) + * [Code Factoids](#code-factoids) + * [Modules](#modules) + * [Command documentation](#command-documentation) + * [Administrative commands](#administrative-commands) + * [Channel management commands](#channel-management-commands) + * [Miscellaneous commands](#miscellaneous-commands) + + +## About + +PBot has an advanced interpreter and several useful core built-in commands. + +## Advanced interpreter + +PBot has an advanced command interpreter with useful functionality. + +### piping + +You can pipe output from one command as input into another command, indefinitely. + + !echo hello world | {sed s/world/everybody/} | {uc} + HELLO EVERYBODY + +### command substitution + +You can insert the output from another command at any point within a command. This +substitutes the command with its output at the point where the command was used. + + !echo This is &{echo a demonstration} of command substitution + This is a demonstration of command substitution + +For example, suppose you want to make a Google Image Search command. The naive +way would be to simply do: + + !factadd img /call echo https://google.com/search?tbm=isch&q=$args + +Unfortuately this would not support queries containing spaces or certain symbols. But +never fear! We can use command substitution and the `uri_escape` function from the +`func` command. + +Note that you must escape the command substitution to insert it literally into the +factoid otherwise it will be expanded first. + + !factadd img /call echo https://google.com/search?tbm=isch&q=\&{func uri_escape $args} + + !img spaces & stuff + https://google.com/search?tbm=isch&q=spaces%20%26%20stuff + +### command splitting + +You can execute multiple commands sequentially as one command. + + !echo Test! ;;; me smiles. ;;; version + Test! * PBot smiles. PBot version 2696 2020-01-04 + +### advanced $variable interpolation + +You can use factoids as variables and interpolate them within commands. + + !factadd greeting "Hello, world" + + !echo greeting is $greeting + greeting is Hello, world + +PBot variable interpolation supports [expansion modifiers](doc/Factoids.md#expansion-modifiers), which can be chained to +combine their effects. + + !echo $greeting:uc + HELLO, WORLD + +### inline commands + +You can invoke up to three commands inlined within a message. If the message +is addressed to a nick, the output will also be addressed to them. + + newuser13: Check the !{version} and the !{help} documentation. + newuser13: PBot version 2696 2020-01-04 + newuser13: To learn all about me, see https://github.com/pragma-/pbot/tree/master/doc + +## Types of commands + +There are a few different types of commands in PBot. + +### Built-in commands + +#### Plugins + +### Factoids + +#### Code Factoids + +#### Modules + +## Command documentation + +### Administrative commands + +### Channel management commands + +### Miscellaneous commands + +