@top-gg/sdk package is the official Top.gg library for Node.js. It lets you post your bot’s server count, listen for vote webhooks, and query bot and user data from the Top.gg API. The SDK works with both discord.js and Eris, including sharded bots via ShardingManager.
Installation
For Deno, an unofficial community port is available at github.com/link-discord/topgg-deno.
Auto-posting stats
Thetopgg-autoposter package handles posting your bot’s server count to Top.gg on a fixed interval. Pass your Top.gg token and your Discord client (or ShardingManager) to AutoPoster and it will take care of the rest.
autoposter.js
Receiving vote webhooks
Use@top-gg/sdk together with Express to receive real-time vote events. The Webhook class validates the incoming request against your webhook authorization string and calls your handler with the vote payload.
webhook.js