Auto-Poster for Top.gg
npm install topgg-autoposterjs
const { AutoPoster } = require('topgg-autoposter')
const poster = AutoPoster('topggtoken', client) // your discord.js or eris client
// optional
poster.on('posted', (stats) => { // ran when succesfully posted
console.log(Posted stats to Top.gg | ${stats.serverCount} servers)
})
`
You can also do poster.on('error', (err) => { ... }) and this will stop errors from being logged and left for you to handle
And that's it!
It will begin to post your server count, and shard count every 30 minutes.
This even work on individual Discord.JS shards that are process separated.
If you would like to do specific clients, DJSPoster & ErisPoster & DJSSharderPoster & RosePoster are all exported classes!
Traditional Discord.JS Sharding:
If you use Discord.JS' traditional ShardingManager sharder, you can also append the AutoPoster to the sharding manager like so:
`js
const sharder = new Discord.ShardingManager(...)
const poster = AutoPoster('topggtoken', sharder)
sharder.spawn() // rest of your stuff!
`
This will run broadcastEval's and automatically fetch your statistics!
Discord-Rose posting
`js
const master = new Master(...)
const poster = AutoPoster('topggtoken', master)
``