Triggers and prefixes
A custom command starts with the prefix of the server, ! by default: !hello. A command can also have its own trigger,
so people can start it in another way:
!customcommand trigger <name> <type> [text]| Type | It starts when… | Example | Message that starts it |
|---|---|---|---|
command |
The message starts with the prefix of Petto and the name. This is the default | !hello |
|
prefix |
The message starts with its own prefix and the name | !customcommand trigger hello prefix ? |
?hello |
startswith |
The message starts with some words | !customcommand trigger hi startswith hey bot |
hey bot, how are you? |
exact |
The message is exactly some words | !customcommand trigger gm exact good morning |
good morning |
contains |
The message has some words inside | !customcommand trigger pizza contains pizza |
I want pizza! |
Without a type, !customcommand trigger <name> shows how the command starts now.
How it matches
Section titled “How it matches”- The case does not matter:
Good Morningmatchesgood morning. - A word is never cut in the middle:
pizzamatchesI love pizza!but notpizzasorunpizza. - The arguments are what comes after the trigger. For
?hello big world,.Argsis["big", "world"]. Forcontains,.RawArgsis the whole message. - A command with a trigger of its own is not also started by the prefix of Petto. Setting
commandgoes back to that. - A prefix is up to 5 characters without spaces, such as
?,>>or.. The other texts are up to 50 characters. A trigger cannot hold a mention. - If two commands could match the same message, the first one by name (alphabetical order) runs. Only one command runs for each message.
- A prefix plus a name cannot be the name of a real command of Petto.
Limits
Section titled “Limits”A server can have up to 25 commands with a trigger of their own. Each person can use each command once every 2 seconds, so a
contains trigger cannot be used to flood a channel.
- Use
prefixto make commands that feel like their own bot:?roll,>>shop. - Use
exactfor greetings and short phrases, andcontainssparingly: it reads every message of the server. - The code can tell how it started:
.Cmdis the name of the command and.Prefixis the prefix that started it (empty forstartswith,exactandcontains).
