Custom Commands
All commands are prefixed by a !
. Meaning the command addcmd
should be typed as !addcmd blah blah blah blah
in chat.
The only exception is custom commands. Command names when you create a custom command are as-is.
That means, if you do: !addcmd test Hello world!
typing test
as the first word in a message will make the bot say Hello world!
.
If you want commands to be prefixed with !
like normal commands, you have to do !addcmd !test Hello world!
instead.
Parameters are specified as <required>
, [optional]
and (none)
.
- Command name:
addcmd
- Parameters:
<command> <text>
- Description:
- Adds a custom command that is available for everyone in the server to use.
- Parameters:
- Command name:
delcmd
- Parameters:
<command>
- Description:
- Deletes a custom command.
- Parameters:
- Command name:
editcmd
- Parameters:
<command> <text>
- Description:
- Edits an already existing command to say something else.
- If you’re going to edit a command, I recommend using
!showcmd
on the command, to make sure you have all the formatting correctly.
- Parameters:
- Command name:
reloadcmds
- Parameters:
(none)
- Description:
- Will reload custom commands from the backend database.
- Parameters:
- Command name:
showcmd
- Parameters:
<command>
- Description:
- Displays the Discord formatting of an existing custom command.
- Useful for editing commands with special text formatting (e.g. bold, code blocks, etc.)
- Parameters:
- Command name:
commands
- Parameters:
[full]
- Description:
- Displays the available custom commands.
- The commands listed are available for anyone in the Discord server to use.
- [Moderator only] If
full
is specified, it will give a complete list of all custom commands with their command name and response, attached as a text file.
- Parameters:
Custom Command Variables
Variables are used for dynamic values. Every variable name (and sometimes, value) is specified inside $()
. Example: $(user)
Currently variables cannot be included inside each other. For example: You can’t use a $(1)
inside a $(fetch)
.
However, they do work alongside each other. For example: You can use a $(1)
, a $(target)
and a $(fetch)
in the same command as long as they’re not “wrapped” inside each other and used in separate parts of the same command.
These are currently supported:
$(user)
- Description:
- Replaces
$(user)
with a user mention of the user that just posted the message.
- Replaces
- Example:
- Command:
!addcmd !hello Hello, $(user).
- If
@Decicus#0001
uses the!hello
command, then the response from the bot will be:Hello, @Decicus#0001
.
- Command:
- Description:
$(target)
- Description:
- Replaces
$(target)
with the first user mentioned when using the command. - If no user is mentioned in the command, it will default to the user that posted the command (similar to
$(user)
).
- Replaces
- Example:
- Command:
!addcmd !noob You suck, $(target)
- If
@Decicus#0001
posts:!noob @Cease#4242
, the bot will respond with:You suck, @Cease#4242
- If only
!noob
is posted instead, the bot will respond with:You suck, @Decicus#0001
- Command:
- Description:
$(fetch INSERT_URL_HERE)
- Description:
- The ‘fetch’ variable is a bit more ‘complex’ in a way. It allows “fetching” (sending a HTTP request to) a remote resource (preferably text output) in realtime from a remote web service.
- For those of you familiar with Nightbot, it works similarly to Nightbot’s
$(urlfetch)
. - Works well with one of my other projects, DecAPI :^)
- Requests
- Example:
- Command:
!addcmd !avatar The Twitch channel avatar for playBATTLEGROUNDS: $(fetch https://decapi.me/twitch/avatar/playbattlegrounds)
- Result:
The Twitch channel avatar for playBATTLEGROUNDS: https://static-cdn.jtvnw.net/jtv_user_pictures/playbattlegrounds-profile_image-8abd92c250bb2d32-300x300.jpeg
- Command:
- Description:
$(NUMBER)
- Description:
NUMBER
can be any integer (whole number) from 1 and up.- It will be replaced with the “word” at that position when using the command. If a “word” doesn’t exist at that position, it will default to
[undefined]
.
- Example:
- Command:
!addcmd !123 $(1) $(2) $(3)
- Usage #1:
!123 Hello world!
- Result #1:
Hello world! [undefined]
. - Usage #2:
!123 Hello world! BEEP BOOP TEST
- Result #2:
Hello world! BEEP
- Command:
- Description: