This is an old revision of the document!
command context
The command context table type contains the contextual information about a command invocation.
args
The args field contains a sequential table with the arguments specified, including the unprefixed name of the command that invoked the command and any blank entries are skipped.
For example, !exrate 20 eur <indetermine amount of spaces here> usd
will results in a Lua table that looks like { [1] = 'exrate', [2] = '20', [3] = 'eur', [4] = 'usd' }
.
msg
The msg field contains a message type table with the details of the message that invoked this command.
send
The send field contains a function that can be used to send a message in the channel that a command was invoked in. If the invoking message was sent in a public channel, the text issued to this command will be sent as a message in that channel, if the user sent the command through a direct message, the message will be sent as a direct message to that user.
Syntax
send(text: string): ()
The function takes a single argument that should be a non-empty string, if an empty string is provided the function will not error but the invoke will be discarded. No return values are given.
respond
The respond field contains a function that can be used to send a direct message to the user that invoked the command.
Syntax
respond(text: string): ()
The function takes a single argument that should be a non-empty string, if an empty string is provided the function will not error but the invoke will be discarded. No return values are given.