1.1.5 • Published 6 years ago
dblist-api v1.1.5
dblist-api
Installation
npm install dblist-api
Example
Example of posting server count with supported libraries (Discord.js and Eris)
const Discord = require("discord.js");
const client = new Discord.Client();
const dbl = require("dblist-api");
const dblist = new dbl('Your token', client);
dblist.on('posted', () => {
console.log('Server count posted!');
})
dblist.on('error', e => {
console.log(`Something went wrong! ${e}`);
})
Example of using webhooks to receive new votes
const dbl = require('dblist-api');
const dblist = new dbl('Your token', { webhookPort: 3080, webhookAuth: 'P4SSw0rD' });
dblist.webhook.on('ready', hook => {
console.log(`Webhook is running at http://${hook.hostname}:${hook.port}${hook.path} ( Type your URL on bot settings on https://dblista.pl/ )`);
});
dblist.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Example of post bot stats
const client = new Discord.Client();
const dbl = require("dblist-api");
const dblist = new dbl('Your token', client);
dblist.postStats();