top.gg
TypeScript icon, indicating that this package has built-in type declarations

2.3.2 • Public • Published

Top.gg

THIS IS A FORK OF THE OFFICIAL dblapi.js PACKAGE FOR PEOPLE

Installation

npm install top.gg

Documentation

Documentation can be found here

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("top.gg");
const dbl = new DBL('Your top.gg token', 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('top.gg');
const dbl = new DBL(yourDBLTokenHere, { 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!`);
});

Package Sidebar

Install

npm i top.gg

Weekly Downloads

27

Version

2.3.2

License

Apache-2.0

Unpacked Size

33.1 kB

Total Files

8

Last publish

Collaborators

  • androz2091