Node.js Wrapper

Last updated 12 days ago

You can use the official Node module to access the API from your Node.js code.

Step 1: Install the wrapper

npm i discord-bots-group/npm-wrapper

Step 2: Initialize the wrapper

const DBGWrapper = require('discordbots.group');
const dbg = new DBGWrapper('Bot ID', 'Token');

Get list stats

dbg.getStats().then(stats => {
console.log(stats);
}).catch((e) => {
console.error(e);
})

Get all bots on the site

dbg.getBots().then(bots => {
console.log(bots);
}).catch((e) => {
console.error(e);
})

Get all site users

dbg.getUsers().then(users => {
console.log(users);
}).catch((e) => {
console.error(e);
})

Get information for a specified bot

dbg.getBot('509277637928157195').then(bot => {
console.log(bot);
}).catch((e) => {
console.error(e);
})

Get information about the current bot

dbg.getCurrent().then(bot => {
console.log(bot);
}).catch((e) => {
console.error(e);
})

Post server count to DBG

dbg.updateCount(10).then(bot => {
console.log(bot);
}).catch((e) => {
console.error(e);
})

Check if a user has voted

dbg.hasVoted('449653897695461376').then(votes => {
console.log(votes);
}).catch((e) => {
console.error(e);
})