2.0.3 • Published 3 years ago

nextgenapi.js v2.0.3

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

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
ParameterTypeOptionalDescription
tokenStringNoThe API Auth Token found on your bots page.
clientSnowflakeNoThe 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
ParameterTypeOptionalDescription
daily_votesNumberYesFetch the Daily Votes for the Bot.
short_descSnowflakeYesFetch the Short Description for the Bot.
prefixStringYesThe Bots Prefix.
ownerIDSnowflakeYesThe Bot Owners ID
tagsStringYesList of the Bots Tags on our Website.
supportStringYesThe Bots assigned Support Link Token (NOTE: This only returns the Invite Token you have to add the link Example: https://discord.gg/${7v4fNuF5Bm})
total_votesNumberThe Bots total Vote Count.
guildsNumberTotal 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")