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:
- Specify a single argument using a dollar sign (
$
) and the numeric position of the argument
- 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.
Note: If you're using a string as a single argument and it contains spaces, you should quote the string when passing the argument, like so (assuming /alias !echo "/speak You said: $1"
)
!echo "This is a string with spaces as a single argument"
This isn't needed with ...
syntax because it passes all available arguments.