Response Values

Tennu Message events that have a `"channel"` property (including all commands can return values telling Tennu to respond to the message with a certain message. This return value is called the `Response`.

The Response has a type of undefined | string | [string] | {intent, message, query, target} | Promise<Response>.

The return value can also a promise of the previous values.

undefined

You can totally return nothing at the end of a handler. Tennu will not respond in that case.

String

The simplest of the return values, this string is sent to the channel in a privmsg.

Using this, we can create a really simple echobot:

client.on('privmsg', function (privmsg) {
    return privmsg.message;
});

Array of Strings

Just as Client.say can take an array of strings, you can also return an array of strings, and each string will be said to the channel in the order sent.

Response Object

Property Description
message string | [string] | [CtcpTag, CtcpBody]

The message or list of messages to send to the target. When the intent is "ctcp" or "ctcpRequest" or "ctcpResponse", the third type must be used.

intent "say" | "act" | "ctcp" | "ctcpRequest" | "ctcpResponse" | "notice" | "none" | undefined

"say"
A normal privmsg response.
"act"
A privmsg wrapped around with the CTCP Action characters. Equivalent to /me in user clients.
"ctcp"
A privmsg wrapped around with CTCP characters. The message property must be [CtcpType, CtcpBody].
"ctcpRequest"
A privmsg wrapped around CTCP requesting information from another user or everybody in a channel. The message property must either be [CtcpTag] or [CtcpTag, CtcpBody].
A response to a CTCP request. The message property must be [CtcpTag, CtcpBody].
"notice"
A notice to the target.
"none"
Completely disregard this object, and send nothing.
undefined
Defaults to "say"
target NickName | ChannelName

The nickname or channel to send the message to.

query Boolean

Whether to disregard the target, and send the message to the message's sender.

Promise

You can return a Promise of any of the previous values, and the system will process your response when the promise resolves.