Skip to content

Registering commands

swizzin.command(name, fn, description?)

Adds /name. The name is 1 to 32 letters, digits or underscores. The function receives ctx and args.

ctx field Meaning
network, network_name Where the command was typed
me Your nickname on that network
target The active channel or conversation (absent in a server window)
text The raw text after the command
command The command name

args is a read-only list of the whitespace-separated words of text (at most 50).

--! name: Shout
--! api: 1
--! permissions: send
swizzin.command("shout", function(ctx, args)
if ctx.target ~= nil then
swizzin.send(ctx.target, string.upper(ctx.text))
end
end, "Send your text in capitals")

Typing /shout hello in a channel sends HELLO to it.

  • Built-in commands.
  • The names theme, channels, scripts and script.
  • A name already provided by another script.

Protected command, then built-in command, then your enabled native alias, then script command. If an alias has the same name as a script command, the alias wins, and the Script Manager shows that it shadows the script. /!name always bypasses aliases and scripts.

A toolbar button can run a script command with the action script:<command>. The button is greyed, with the reason in its tooltip, unless an approved, running script provides that command.