The official NPM Module for interacting with the Next Gen Bots API
npm i nextgenapi.js@latest
or
npm i nextgenapi.js@2.0.3
or
npm i nextgenapi.js --save
Append the Line below to your package.json
"nextgenapi.js": "^2.0.3",
• Save and profit
NextGen(client, token)
Parameter | Type | Optional | Description |
---|---|---|---|
token | String | No | The API Auth Token found on your bots page. |
client | Snowflake | No | The Client ID for the bot you want to post stats to. |
const Discord = require("discord.js")
const client = new Discord.Client()
const prefix = "!";
const NextGen = require("nextgenapi.js")
const ngbl = new NextGen(client.user.id,"bot-auth-token")
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}.`)
setInterval(() => {
ngbl.postStats(client.guilds.cache.size)
})
}, 300000) // 5 Minutes in MS
client.on("message", message => {
if(message.author.bot) return
if(message.content == prefix + "ping"){
message.reply(`Pong! it took ${client.ws.ping}`)
}
})
client.login("token")
NextGen()
Parameter | Type | Optional | Description |
---|---|---|---|
daily_votes | Number | Yes | Fetch the Daily Votes for the Bot. |
short_desc | Snowflake | Yes | Fetch the Short Description for the Bot. |
prefix | String | Yes | The Bots Prefix. |
ownerID | Snowflake | Yes | The Bot Owners ID |
tags | String | Yes | List of the Bots Tags on our Website. |
support | String | Yes | The Bots assigned Support Link Token (NOTE: This only returns the Invite Token you have to add the link Example: https://discord.gg/${7v4fNuF5Bm} ) |
total_votes | Number | The Bots total Vote Count. | |
guilds | Number | Total Number of Guilds the Bot is in (If posting stats) |
const Discord = require("discord.js")
const client = new Discord.Client()
const prefix = "!";
const NextGen = require("nextgenapi.js")
const stats = new NextGen()
client.on("ready", () => { // ready listenerconsole.log(`Logged in as ${client.user.tag}`)})
client.on("message", message => { // message listener
if(message.author.bot) return;
if(message.channel.type !== "text") return;
if(!message.content.toLowerCase().startsWith(prefix)) return;
if(message.content == (prefix + "ping")){
message.reply(`Pong ${client.ws.ping}ms`)
}
if(message.content == (prefix + "stats")){
stats.get(client.user.id, function(data){
let embed = new MessageEmbed()
.addField("Total Votes", data.total_votes);
message.channel.send(embed)
})
}
})
client.login("token")