rune.command
Slash commands add /name verbs to the input line. For a
task-oriented introduction, see Slash Commands.
Quick reference
Section titled “Quick reference”rune.command.add(name, handler, description?, opts?) -- register /namerune.command.remove(name) -- unregister; true if it existedrune.command.get(name) -- the raw handler, or nilrune.command.enable(name) -- re-enable (also recovers from quarantine)rune.command.disable(name) -- disable without unregisteringrune.command.list() -- array of {name, description, enabled, group, source}add returns a handle; opts accepts
group from the common options (the item’s
name is the command name itself).
rune.command.add
Section titled “rune.command.add”rune.command.add(name, handler, description?, opts?) -> handlename(string) — the command name, without the slash. Re-adding the same name replaces the old handler (upsert).handler(function) —function(args);argsis everything after/nameas a single string (""when there are no arguments).description(string, optional) — shown in/helpand the/command picker.opts(table, optional) —{group = "..."}.
rune.command.add("greet", function(args) rune.send("say Hello, " .. (args ~= "" and args or "everyone") .. "!")end, "Greet someone")/help and the / picker are generated from the registry, so
user-added commands appear in both automatically.
Each command is quarantined individually —
a command that throws three times in a row is disabled with a notice,
and input handling keeps working. Fix the error and
rune.command.enable(name) (or /reload) to recover.
Managing
Section titled “Managing”Standard registry management applies:
rune.command.enable/disable/remove(name), .list() — see
Registries. /help lists everything.
Related: Slash Commands guide · rune.alias · rune.bind · Slash Commands reference