plug-dj-api
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Plug.dj API

A generic library to create plug.dj bots.

Usage

const PlugApi = require('plug-dj-api');

const plugApi = new PlugApi();

const options = {
  roomId: '',
  username: '',
  password: '',
};

(async () => {
  try {

    // Login and visit room
    await plugApi.connect(options);

    console.log(`Connected to room: ${options.roomId}`);

    // Handle CHAT events
    plugApi.on('CHAT', data => {
      console.log(data);
    });

    // Handle song ADVANCE
    plugApi.on('ADVANCE', data => {
      plugApi.sendChat('Song transitioned!');
    });

  } catch (err) {
    console.log(`Error setting up api: ${err}`);
  }
})();

Sample bot

Follow these steps to run the provided sample bot:

  1. Install dependencies
$ npm install
  1. Build the project
$ npm run build
  1. Configure your bot credentials
// Copy sample config and edit credentials within
$ cp example/config.sample.json example/config.json
  1. Run it
$ node example/bot.js

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i plug-dj-api

Weekly Downloads

0

Version

0.1.2

License

ISC

Unpacked Size

22.1 kB

Total Files

18

Last publish

Collaborators

  • minustime