Listing and events
guideIntercept every command before its checks run, list every one that's loaded, and log each use.
This page covers on discord command used, the event every command goes through before its checks, and listing the commands currently loaded. You're assumed to have a bot named "my-bot" logged in.
Intercepting a command
on discord command used fires for every command, before executable in, roles, permissions and cooldown are even checked. cancel event inside it stops the command outright, before its trigger ever runs; it is one of the two cancellable DiSky events.
discord command blocked: prefixes: "!" trigger: reply with "this should never run" on discord command used: if name of event-discordcommand is "blocked": cancel event reply with "blocked by 'on discord command used'"
event-discordcommand is the command, and used prefix, used alias, used arguments say exactly how it was typed; the same three expressions work inside the command's own trigger. Filter to one bot the usual way, with on discord command used seen by "my-bot":.
Log every use the same way, before any check can refuse it:
on discord command used: send "%event-user% ran %name of event-discordcommand% (prefix=%used prefix%, alias=%used alias%, args='%used arguments%')" to console
discord command (use|used|invoked)Fired when a message matches a 'discord command' structure, before its checks (channel, roles, permissions, cooldown) and before its trigger runs. Cancel it to stop the command entirely. 'event-discordcommand' is the command, 'used prefix' / 'used alias' / 'used arguments' tell how it was typed.Listing commands
all discord commands returns every command loaded from every script, as a list of discordcommand values. Each one exposes its declared entries, read-only:
Property | Returns |
|---|---|
the command's name | |
the | |
the | |
the | |
the command's aliases, without its main name | |
the command's prefixes; empty when it answers to its bare name | |
the |
discord command help: prefixes: "!" trigger: set {_lines::*} to "" loop all discord commands: add "%name of loop-value%: %usage of loop-value%" to {_lines::*} reply with join {_lines::*} with nl
Group the reply by category of loop-value once you have more than a handful of commands. The list always matches what's currently loaded: reloading a script adds or removes its commands from it immediately, without restarting the bot.
[all [of]] [the] [registered] discord commandsEvery 'discord command' currently loaded, from every script.
Discord Command
type
7 syntaxes
A command declared with the 'discord command' structure. Available as 'event-discordcommand' in its trigger and in the 'discord command used' / 'failed' events, or through 'all discord commands'.