Package Exports
- nextgenapi.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nextgenapi.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Next Gen Bot List API Wrapper
The official NPM Module for interacting with the Next Gen Bots API
Support
Documentation
Installation
npm i nextgenapi.js@latest
or
npm i nextgenapi.js@2.0.3
or
npm i nextgenapi.js --save
Hard Coded Install
Append the Line below to your package.json
"nextgenapi.js": "^2.0.3",• Save and profit
Posting Stats
Constructor
NextGen(client, token)Arguments
| 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. |
Discord.js v12 Example
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")
Getting Stats
Constructor
NextGen()Arguments
| 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) |
Example
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")