Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

irclib

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

irclib

Library for IRC clients

  • 1.0.0-beta.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

irclib

Library for making IRC clients

Table of Contents

  1. Installation
  2. Usage
    1. Options
    2. Events
    3. Components
  3. API Reference

Installation

$ npm install --save irclib

Usage

const { Client } = require('irclib')
const options = {
    //... See doc below
}

const client = new Client(options)
client.start()

Options

OptionDescriptionDefault valueMandatory
hostIP Address or hostnameN/AYes
portPort6667No
sslSSL engineNoNo
channelsList of default join channels[]No
partMessageMessage when the lib parts from a channel[IrcLib] Good Bye.No
quitMessageMessage when the lib disconnects from the server[IrcLib] Good Bye.No
passwordPassword of the server''No
encodingText encodingutf8No
versionResponse text of the CTCP versionVersion info in the package.json of your applicationNo
userUser informationN/AYes
nicknameInitial nicknameN/AYes
realnameReal nameN/AYes
alternativeAlternative nicknameNickname + _No
usernameUser nameN/AYes
nickservNickServ password if the nickname is registeredN/ANo
extraCustom application data for this client (must be an object){}No
debugLevelDebug Level code (error, warning, info, debug)warningNo

Events

EventDescription
pubmsgEvent received when a message is sent to a channel
privmsgEvent received when a message is sent to the user
pubnoticeEvent received when a notice is sent to a channel
privnoticeEvent received when a notice is sent to the user
joinEvent received when an user joins a channel
partEvent received when another user parts from a channel
quitEvent receievd when another user quits
errorEvent received when the IRC server emits an error
nickEvent received when an user changes his nickname
kickEvent received when an user is kicked from a channel
pingEvent received on a PING request
inviteEvent received when another user invites the user on a channel
modeEvent received when a mode is changed

Every event callback takes 4 arguments :

  • sender: User information of the sender
  • middle: Middle information of the message
  • params: Array with other middle information
  • trailing: Trailing text of the message

There is a complete list of other events on this page. Every event can be bound by its numeric code or by a short version of the name. Example : RPL_WELCOME is bound to the welcome event.

Components

You can use components to make your code clear.

pubmsg.js

module.exports = (client) => {
    client.on('pubmsg', (sender, channel, message) => {
        console.log(`Message received from ${sender} on ${channel}: ${message}`)
    })
}

index.js

client.component(require('./pubmsg'))

API Reference

Class Client

on(event, callback)

Registers an event with a callback. Returns the client to allow event chaining.

start()

Starts the client by establishing the connection and listening for incoming data.

privmsg(target, message)

Sends a message to a channel or an user identified by target.

notice(target, message)

Sends a notice to a channel or an user identified by target.

action(target, message)

Sends a mIRC-styled action message (/me) to a channel or a user identified by target.

join(target)

Sends a join message to enter a channel identified by target.

part(target, message)

Sends a part message to leave a channel identified by target before leaving the channel.

quit(message)

Sends a quit message to the server before quitting the network.

mode(channel, modificators, targets = [])

Sends a mode message on a channel with inline modificators, eventually applied to targets.

FAQs

Package last updated on 28 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc