Inherits EventEmitter. Read more on the Events available here.
new Irc.Client({
nick: 'ircbot',
username: 'ircbot',
gecos: 'ircbot',
encoding: 'utf8',
version: 'node.js irc-framework',
enable_chghost: false,
enable_echomessage: false,
auto_reconnect: true,
auto_reconnect_max_wait: 300000,
auto_reconnect_max_retries: 3,
ping_interval: 30,
ping_timeout: 120,
sasl_disconnect_on_fail: false,
account: {
account: 'username',
password: 'account_password',
},
webirc: {
password: '',
username: '*',
hostname: 'users.host.isp.net',
ip: '1.1.1.1',
options: {
secure: true,
'local-port': 6697,
'remote-port': 21726,
},
},
client_certificate: {
private_key: '-----BEGIN RSA PRIVATE KEY-----[...]',
certificate: '-----BEGIN CERTIFICATE-----[...]',
},
});
To accommodate backwards compatibility support, the account
configuration can behave in different ways depending what data types its provided.
When the account
property is falsy, options.nick
and options.password
will be used for SASL Auth.
If the account
property is an object, account.account
and account.password
will be used for SASL Auth.
To Completely disable SASL Auth, set account
to an empty object, eg: account: {}
.
If connected to the IRC network and successfully registered
Once connected to an IRC network, this object will have these properties:
.nick
The current nick you are currently using.username
Your username (ident) that the network sees you as using.gecos
Your current gecos (realname).host
On supported servers, the hostname that the networksees you as using.away
Your current away status. Empty for not away.modes
A Set() instance with your current user modes
Request an extra IRCv3 capability
Add middleware to handle the events for the client instance
Start connecting to the IRC network. If connect_options
is provided it will
override any options given to the constructor.
Send a raw line to the IRC server
Generate a formatted line from either an array or arguments to be sent to the IRC server.
Quit from the IRC network with the given message
Ping the IRC server to show you're still alive.
Attempt to change the clients nick on the network
Send a message to the target, optionally with tags.
Send a notice to the target, optionally with tags.
Send a tagged message without content to the target
Join a channel, optionally with a key/password.
Part/leave a channel with an optional parting message.
Set the topic of a channel, if newTopic is falsy or only whitespace then .clearTopic()
will be called.
Remove the topic of a channel.
Send a CTCP request to target with any number of parameters.
Send a CTCP response to target with any number of parameters.
Send an action message (typically /me) to a target.
Receive information about a user on the network if they exist. Optionally calls
cb(event)
with the result if provided.
Receive a list of users on the network that matches the target. The target may be
a channel or wildcard nick. Optionally calls cb(event)
with the result if
provided. Multiple calls to this function are queued up and run one at a time in
order.
Request that the IRC server sends a list of available channels. Extra parameters will be sent.
Create a channel object with the following methods:
say(message)
notice(message)
action(message)
part([part_message])
join([key])
Compare two strings using the networks casemapping setting.
Uppercase the characters in string using the networks casemapping setting.
Lowercase the characters in string using the networks casemapping setting.
Call cb()
when any incoming message matches match_regex
.
Call cb()
when an incoming notice message matches match_regex
.
Call cb()
when an incoming plain message matches match_regex
.
Call cb()
when an incoming action message matches match_regex
.
Add target
to the list of targets being monitored. target
can be a comma-separated list of nicks.
Remove target
from the list of targets being monitored. target
can be a comma-separated list of nicks.
Clear the list of targets being monitored.
Return the current list of targets being monitored. Optionally calls cb()
with the result.
Query the current list of targets being monitored. Will emit users online
with targets that are online,
and users offline
with targets that are offline.