message plugins¶
events¶
-
message¶
The message event, fired when a standard IRC message is received.
Event attributes:
user- User who sent the message.channel- Channel this message was sent to.message- The actual message.isAction-trueif this was an action (/me).
Example:
client.on('message', function (event) {
console.log('[' + event.channel.getName() + '] ' + event.user.getNick() + ': ' + event.message);
event.reply('I logged to the console!'); // Says to the relevent user "I logged to the console!", either in PM or the channel.
});
-
privatemessage¶
The privatemessage event, fired when an IRC private message is received.
Like a message, but more private.
Event attributes:
user- User who sent the message.message- The actual private message.isAction-trueif this was an action (/me).
Example:
client.on('privatemessage', function (event) {
console.log('[PM] ' + event.user.getNick() + ': ' + event.message);
event.reply(':)'); // Says to the relevent user ":)", in PM
});
-
notice¶
The notice event, fired when an IRC notice is received.
Like a message, but more private.
Event attributes:
from- User who sent the notice.to- Where this notice was sent to.message- The actual notice message.
Example:
client.on('notice', function (event) {
console.log('[' + event.to + '] ' + event.from.getNick() + ': ' + event.message);
});
functions¶
-
send(target, msg, network, fn)¶ Param object/string target: The channeloruserobject to send this message to.Param string msg: The message you want to send. Param string network: The network to execute the command on. Param function fn: The callback function to be called when the call has been finished.
Send an IRC message to a channel or a user.
Example:
client.send("#caffeinery", "Hiii", event.network); // usage in an event listener
client.send("#caffeinery", "Hiii", "freenode"); // send to specific network
client.send(event.channel ? event.channel : event.user, "Hiii", event.network); // reply to message
// ...or use the event.reply helper
event.reply("Hiii!"); // reply to message
-
action(target, msg, network, fn)¶ Param object target: The channeloruserobject to send this action to.Param string msg: The action you want to send. Param string network: The network to execute the command on. Param function fn: The callback function to be called when the call has been finished.
Send an IRC action to a channel or a user. (This is the /me command) Works like send(target, msg, network, fn).
Example:
client.action("#caffeinery", "Hiii", event.network); // usage in an event listener
client.action("#caffeinery", "Hiii", "freenode"); // send to specific network
client.action(event.channel ? event.channel : event.user, "Hiii", event.network); // reply to message
// ...or use the event.replyAction helper
event.replyAction("Hiii!"); // reply to message
-
notice(target, msg, network, fn)¶ Param object target: The channeloruserobject to send this notice to.Param string msg: The notice you want to send. Param string network: The network to execute the command on. Param function fn: The callback function to be called when the call has been finished.
Send an IRC notice to a channel or a user. Works like send(target, msg, network, fn).
Example:
client.notice("#caffeinery", "Hiii", event.network); // usage in an event listener
client.notice("#caffeinery", "Hiii", "freenode"); // send to specific network
client.notice(event.channel ? event.channel : event.user, "Hiii", event.network); // reply to message
// ...or use the event.replyNotice helper
event.replyNotice("Hiii!"); // reply to message