dubapi

2.1.0 • Public • Published

DubAPI

About

A Node.js API for creating queup.net bots.

Installation

npm install dubapi

Optionally, the websocket implementation can make use of native addons for performance and spec compliance.

npm install --save-optional bufferutil utf-8-validate

Usage

var DubAPI = require('dubapi');

new DubAPI({username: '', password: ''}, function(err, bot) {
    if (err) return console.error(err);

    console.log('Running DubAPI v' + bot.version);

    function connect() {bot.connect('friendship-is-magic');}

    bot.on('connected', function(name) {
        console.log('Connected to ' + name);
    });

    bot.on('disconnected', function(name) {
        console.log('Disconnected from ' + name);

        setTimeout(connect, 15000);
    });

    bot.on('error', function(err) {
        console.error(err);
    });

    bot.on(bot.events.chatMessage, function(data) {
        console.log(data.user.username + ': ' + data.message);
    });

    connect();
});

Credit

Readme

Keywords

Package Sidebar

Install

npm i dubapi

Weekly Downloads

2

Version

2.1.0

License

MIT

Unpacked Size

80.4 kB

Total Files

33

Last publish

Collaborators

  • anjanms