Template functions
Help › Custom commands › Functions
Template functions
These are the functions people use most. Arguments go after the function name, separated by spaces.
Messages
sendMessage channelID "text" | Posts in another channel. Use nil for the current one. |
sendDM "text" | DMs the person who triggered the command. |
deleteTrigger 5 / deleteResponse 30 | Deletes the triggering message or the bot's reply after that many seconds. |
addReactions "๐" "๐" | Reacts to the triggering message. |
cembed / complexMessage | Builds embeds and richer messages. See Custom embeds. |
Mentions
By default the bot won't ping roles, @everyone, or @here from a custom command. These functions allow it on purpose:
mentionRoleID roleID / mentionRoleName "Name" | Pings a role. |
mentionEveryone / mentionHere | Pings @everyone or @here. |
Roles
hasRoleID roleID | True if the triggering member has the role. targetHasRoleID userID roleID checks someone else. |
addRoleID roleID / removeRoleID roleID | Adds or removes a role on the triggering member. |
giveRoleID userID roleID / takeRoleID userID roleID | Adds or removes a role on someone else. |
Arguments and members
parseArgs 1 "usage text" (carg "member" "target") | Checks and reads command arguments, and shows the usage text if they're wrong. |
getMember userID | Looks up a member. |
Saving data
dbSet userID "key" value / dbGet userID "key" | Stores and reads a value. Use 0 as the user ID for server-wide values. |
dbIncr userID "key" 1 / dbDel userID "key" | Adds to a stored number, or deletes a value. |
Saved values show up under Custom Commands → Database.
Running other commands later
execCC ccID channelID delay data | Runs another custom command, optionally after a delay in seconds. |
scheduleUniqueCC ccID channelID delay "key" data | Same, but replaces any earlier schedule with the same key. |
Text, numbers, and time
lower, upper, title, joinStr, reFind, randInt, currentTime, and humanizeDurationSeconds cover most everyday needs. sdict, dict, and cslice build maps and lists.