other plugins¶
events¶
-
error
¶
The error
event, fired when any error happens.
Make sure to listen to error
events to see possible errors/warnings:
client.on('error', function (err, event) {
console.log(event.name, err.stack);
});
You can also add the err
parameter to any event listener (change from function (event)
to function (err, event)
:
client.on('whois', function (err, event) {
if (err) console.log("WHOIS ERROR:", err.stack);
console.log("whois:", event);
});
-
errors
¶
The errors
event, fired when IRC errors are received. List of possible errors: https://github.com/williamwicks/irc-replies/blob/master/replies.json#L113-L170
Event attributes:
- None
Example:
client.on('errors', function (err, event) {
console.error('IRC Error:', err);
});
functions¶
-
pass(pass, network, fn)
¶ Param string pass: The password 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.
Sends an IRC PASS command to the network with the specified password (pass
)
Example:
client.on('motd', function (event) {
client.pass('pa$$w0rd', event.network);
});
-
user(username, realname, network, fn)
¶ Param string username: The username Param string realname: The realname 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.
Sends an IRC USER command to the network with the specified username (username
) and realname (realname
).
Example:
client.on('motd', function (event) {
client.user('username', 'Real Name', event.network);
});
-
oper(name, password, network, fn)
¶ Param string name: The oper name Param string password: The oper password 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.
Sends an IRC OPER command and tries to oper to the network with the specified name (name
) and password (password
).
Example:
client.on('motd', function (event) {
client.oper('opername', 'pa$$w0rd', event.network);
});