This is a quick guide on using the new-dblapi
npm package to post your bot stats to discordbots.org. This package is only compatible with discord.js
.
Here are the the sources that are mentioned in the comments below. link 1 link 2 link 3
const { Client } = require('discord.js');
const dbl = require('new-dblapi'); // (link 1)
const client = new Client();
client.on('ready', () => {
console.log(`Bot Ready! Logged in as ${client.user.tag}`);
// initialize DBL class
const DBL = new dbl('insert dbl token', {
port: 5000, // port for WH to listen on (link 2)
path: 'vote', //what follows the wh link (link 2)
auth: 'webhok authorization', // authorization for WH (link 2)
delay: 900000, // delay for posting stats AUTOMATICALLY (link 3) - defaults to 15m
}, client); // you must pass through client
DBL.on('vote', (vote) => {
console.log(`New Vote! ${vote.user}`) // vote.user returns a user id
})
});
client.login('bot token');
See a mistake in my example? Come yell at me here