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

dazeus

v0.7.2

Published

Node.js Bindings for DaZeus

Downloads

39

Readme

DaZeus Node.js Bindings

This package provides bindings for the DaZeus IRC Bot

Getting started

Here's an example echobot, that just repeats every message back to the channel

var dazeus = require("dazeus");
var client = dazeus.connect({path: '/tmp/dazeus.sock'}, function () {
    client.on('PRIVMSG', function (network, user, channel, message) {
        client.message(network, channel, message);
    });
});

Quick Reference

We start by setting up a new instance of the client:

var dazeus = require("dazeus");
var client = dazeus.connect({path: '/tmp/dazeus.sock'}, function () {

});

The connect function will return a client object that can be used to query the server and which will respond to anything DaZeus throws at it. Instead of providing a path variable you may also provide a host and port to connect using TCP.

The provided callback function will be executed as soon as a connection is established. By creating your own listeners and triggering your own actions you can interact with DaZeus

Events

Events may be captured by using the on method on a client object. Please take a look at the DaZeus documentation to see what events are available. The event interface used is that from Node.js's events.EventEmitter. Take a look at their documentation to see how listening to events works in Node.js

Callback arguments depend on the parameters returned by DaZeus. Events you can listen for are:

  • CONNECT
  • DISCONNECT
  • JOIN
  • PART
  • QUIT
  • NICK
  • MODE
  • TOPIC
  • INVITE
  • KICK
  • PRIVMSG
  • NOTICE
  • CTCP
  • CTCP_REP
  • ACTION
  • UNKNOWN
  • WHOIS
  • NAMES
  • PRIVMSG_ME
  • CTCP_ME
  • ACTION_ME

Some examples to get you going:

client.on('PRIVMSG', function (network, user, channel, message) {
    // every event has a different set of parameters
});

client.on('WHOIS', function (network, server, user) {
    // you don't need to specify all parameters if you don't need them
});

Methods

All these methods provide callbacks that are executed when the information requested is provided by the bot. Sometimes this information might be limited to a confirmation of the action performed.

DaZeus.getProperty(property[, scope], callback)

Retrieve a property from the database DaZeus provides.

DaZeus.setProperty(property, value[, scope][, callback])

Store a property in the DaZeus database.

DaZeus.unsetProperty(property[, scope][, callback])

Remove a property from the DaZeus database.

DaZeus.propertyKeys(property[, scope], callback)

Retrieve all keys starting with the given name.

DaZeus.getPermission(permission, scope[, default], callback)

Get a permission (with the given default as a default).

DaZeus.setPermission(permission, scope, allow[, callback])

Set a permission to the given allow or denied value (true for allow, false for deny).

DaZeus.unsetPermission(permission, scope[, callback])

Remove a permission.

DaZeus.message(network, channel, message[, callback])

Send a message to a specific channel on a specific network.

DaZeus.action(network, channel, message[, callback])

Send a '/me' message to a specific channel on a specific network.

DaZeus.notice(network, channel, message[, callback])

Send a notice to a specific channel on a specific network.

DaZeus.ctcp(network, channel, message[, callback])

Send a CTCP request to a specific channel on a specific network.

DaZeus.ctcpReply(network, channel, message[, callback])

Send a CTCP reply to a specific channel on a specific network.

DaZeus.join(network, channel[, callback])

Join a channel.

DaZeus.part(network, channel[, callback])

Leave a channel.

DaZeus.names(network, channel, callback)

Request the list of names in a channel (mode characters are prepended).

DaZeus.nicknames(network, channel, callback)

Request the list of nicknames (with any prefixes removed) in a channel.

DaZeus.networks(callback)

Retrieve the list of networks the bot is connected to.

DaZeus.channels(network, callback)

Retrieve the list of channels the bot has joined for a network.

DaZeus.nick(network, callback)

Retrieve the nickname of the bot.

DaZeus.whois(network, nick, callback)

Send a '/whois' request for a specific nick on a network.

DaZeus.onCommand(command[, network], callback)

Receive a notification when a command is executed, for example to catch }help you would write: DaZeus.onCommand('help', function () { /* ... */ });

DaZeus.reply(network, channel, user, message[, highlight][, callback])

Reply to a message sent by a user in a channel. By default the bot will also add a highlight for the user if the channel is public. This function will also automatically resolve replies in private conversations.