0.0.6 • Published 5 years ago

dblcore.js v0.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

dblcore.js

An unofficial API wrapper for https://top.gg

Installation

npm install dblcore.js

Documentation

Documentation can be found here

Credits

Created based on dblapi.js

Examples

Example of posting server count with supported libraries (Discord.js and Eris)

const Discord = require("discord.js");
const client = new Discord.Client();
const DBLC = require("dblcore.js");
const dbltoken = 'your dbl api token';
const dbl = new DBLC(dbltoken, client);

// Optional events
dbl.on('posted', () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})

Example of using webhooks to receive vote updates

const DBL = require('dblapi.js');
const dbltoken = 'your dbl api token';
const dbl = new DBLC(dbltoken, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});