Added aliases page

Yessiest 2022-02-21 17:37:26 +00:00
parent 485cc56de9
commit b788b350be
1 changed files with 39 additions and 0 deletions

39
Aliases.md Normal file

@ -0,0 +1,39 @@
# Aliases
Aliases are the easiest way to get some things done in this bot.
Aliases are essentially a way to bind a command to some specific keyword that you can activate later.
To use them, load the ``meta`` plugin.
## Syntax
An alias consists of 2 pieces: the trigger and the command.
To create an alias, use the ``alias`` command as follows:
```
alias "name" "command to execute"
```
After you have created an alias, you can simply activate it by typing it's name.
Example (assuming ``toolbox`` plugin is loaded and your prefix is ``/``):
```
/alias "/rules" "/echo ```
Rules of this server:
1) Respect each other.
2) Do not post harmful or violent content.
3) Be cool.
```"
```
## Arguments
Sometimes you might want to pass additional arguments to the command inside an alias.
There are multiple way to do so:
1. Specify a single argument using a dollar sign (``$``) and the numeric position of the argument
2. Specify the entire text after the alias using ellipsis
Examples:
```
/alias "!speak" "/speak ..."
```
When ``!speak`` alias is used, anything after it will be passed to the ``/speak`` command
```
/alias "!exp" "/calculate $1^2"
```
When ``!exp`` is used, the first argument (the first piece of text after the command ending with a space or a newline) is passed into the formula ``n^2``, which is then passed to the ``/calculate`` command.