Table of Contents
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 <indeterminate 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): ()
Arguments
- The first argument should be a non-empty string that will be used as the body of a chat message sent by the bot, if an empty string is provided the function will not error but the invoke will be discarded.
Returns
This function has no return values.
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): ()
Arguments
- The first argument should be a non-empty string that will be used as the body of a chat message sent by the bot, if an empty string is provided the function will not error but the invoke will be discarded.
Returns
This function has no return values.