npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

irclib

v1.0.0-beta.6

Published

Library for IRC clients

Downloads

4

Readme

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

| Option | Description | Default value | Mandatory | | ------ | ----------- | ------------- | --------- | | host | IP Address or hostname | N/A | Yes | | port | Port | 6667 | No | | ssl | SSL engine | No | No | | channels | List of default join channels | [] | No | | partMessage | Message when the lib parts from a channel | [IrcLib] Good Bye. | No | | quitMessage | Message when the lib disconnects from the server | [IrcLib] Good Bye. | No | | password | Password of the server | '' | No | | encoding | Text encoding | utf8 | No | | version | Response text of the CTCP version | Version info in the package.json of your application | No | | user | User information | N/A | Yes | | nickname | Initial nickname | N/A | Yes | | realname | Real name | N/A | Yes | | alternative | Alternative nickname | Nickname + _ | No | | username | User name | N/A | Yes | | nickserv | NickServ password if the nickname is registered | N/A | No | | extra | Custom application data for this client (must be an object) | {} | No | | debugLevel | Debug Level code (error, warning, info, debug) | warning | No |

Events

| Event | Description | | ----- | ----------- | | pubmsg | Event received when a message is sent to a channel | | privmsg | Event received when a message is sent to the user | | pubnotice | Event received when a notice is sent to a channel | | privnotice | Event received when a notice is sent to the user | | join | Event received when an user joins a channel | | part | Event received when another user parts from a channel | | quit | Event receievd when another user quits | | error | Event received when the IRC server emits an error | | nick | Event received when an user changes his nickname | | kick | Event received when an user is kicked from a channel | | ping | Event received on a PING request | | invite | Event received when another user invites the user on a channel | | mode | Event 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.