Communicates with the NickServ IRC service


Provides shortcuts for communicating with NickServ in irc servers.


var irc = require('irc');
var NickServ = require('nickserv');
// Initialize irc client. 
var client = new irc.Client('', 'mynick');
// Use nickserv to handle communication between 
var nickserv = new NickServ('mynick', {
  password: 'hunter2',
  email: ''
nickserv.attach('irc', client);
// callback will get called when nick is identified/registered 
nickserv.ready(function(err) {
  if (err) throw err;
  console.log('I am ready!');

The cool thing about the ready function is that if a password is provided, it will check if the nick is registered, if it is it will try to identify it with NickServ. If it's not registered and an email was provided as well, it will try to register the nick with the given password and email.


options can be a hash with password and email that can optionally be used later with identify, register, and the ready functions.

Nickserv has functions that help communicate with the IRC NickServ service. If a function is called several times in a row, the nickserv command will be sent as soon as it's called, but it will queue the responses to the corresponding commands.

Returns wether or not the current nick has been identified.

Checks if the given nick is registered. If no arguments passed, it becomes synchronous and returns wether or not the current nick is registered. Note that synchronous version relies on knowing if isRegistered(), identify(), or register() have already been called.

Gets info from the given nick. If nick is not given, uses current client nick. info object looks like

  nick: 'nickbot',
  realname: 'nodebot',
  online: true,
  host: 'nickbot@some.IP',
  registered: 'Sep 28 08:43:08 2011 CEST',
  lastquitmsg: 'Ping timeout: 121 seconds',
  email: '',
  options: ['Security', 'Private', 'Auto-op']

Identifies current client nick with the given password.

Reverses the effect of identify().

Registers the current client nick with the given password and email. Some servers require you to be using your nick for some time before it can be registered. In that case, register() will wait and call itself again.

Drops a nick, making it available to be registered again by anyone. If nick is not specified, will drop current client nick.

Verifies registraton for the given nick with the given key.

Set the current client nick password with given password.

Sends a command to NickServ. Use this if a command you want to use hasn't been covered by one of the other functions yet.

If password is given, checks if current nickname is registered. If it's registered, tries to identify. If nick is not registered and email is given, tries to register. When it's all finished and ready, calls callback. Providing options will use that object to get password and email instead of the one from the constructor.

The nickserv object emits a handful events to help you track what it's currently doing or if you prefer to use emitters to callbacks.

isRegistered() is called.

  • boolean - True if nick is registered.
  • string - Nick.

isRegistered() is finished.

info() is called

  • Object - Info.

info() finished getting info successfully.

identify() is called.

identify() successfully finished.

logout() is called.

logout() finished.

register() is called.

register() successfully finished.

drop() is called.

drop() successfully finished.

verifyRegistration() is called.

verifyRegistration() successfully finished.

setPassword() is called.

setPassword() successfully finished.

  • string - Notice.

Emitted when NickServ sends a notice.

  • string - Message.

Emitted when client sends a message to NickServ through this module.


npm install nickserv


This module is hard to test because there are various NickServ software that every IRC server uses. Each one of them has slightly different responses to the functions they provide, and some provide more/less functionality. Running the tests helps to know if this module will work with a server. If it doesn't, it helps make it work.

All tests are written with vows and can be run with npm

npm test

or directly through vows for more control

vows test/test.js --spec

During testing, log files will be created under /test/logs. Logs are useful to figure out exactly what is being sent to and received from NickServ.

If you don't want to test this against a server, use the --logic flag with vows and a mock irc server will be created. This will be much faster and is meant to test only the logic behind nickserv. As oppose to testing what is being sent and received.