Readme
An official module for interacting with the Top.gg API
yarn add @top-gg/sdk
or npm i @top-gg/sdk
The base client is Topgg.Api, and it takes your Top.gg token and provides you with plenty of methods to interact with the API.
Your Top.gg token can be found at top.gg/bot/(BOT_ID)/webhooks
and copying the token.
You can also setup webhooks via Topgg.Webhook, look down below at the examples for how to do so!
API Reference | GitHub | NPM | Discord Server
Auto-Posting stats
If you're looking for an easy way to post your bot's stats (server count, shard count), check out topgg-autoposter
const client = Discord.Client(); // Your discord.js client or any otherconst { AutoPoster } = require("topgg-autoposter");AutoPoster("topgg-token", client).on("posted", () => { console.log("Posted stats to Top.gg!");});
With this your server count and shard count will be posted to Top.gg
Webhook server
const express = require("express");const Topgg = require("@top-gg/sdk");const app = express(); // Your express appconst webhook = new Topgg.Webhook("topggauth123"); // add your Top.gg webhook authorization (not bot token)app.post( "/dblwebhook", webhook.listener((vote) => { // vote is your vote object console.log(vote.user); // 221221226561929217 })); // attach the middlewareapp.listen(3000); // your port
With this example, your webhook dashboard should look like this:
@top-gg/sdk development dependencies
FAQs
What is @top-gg/sdk?
Official Top.gg Node SDK. Visit Snyk Advisor to see a full health score report for @top-gg/sdk, including popularity, security, maintenance & community analysis.
Is @top-gg/sdk popular?
The npm package @top-gg/sdk receives a total of 4,787 weekly downloads. As such, @top-gg/sdk popularity was classified as small. Visit the popularity section on Snyk Advisor to see the full health analysis.
Is @top-gg/sdk well maintained?
We found indications that @top-gg/sdk maintenance is sustainable demonstrating some project activity. We saw a total of 20 open source contributors collaborating on the project. See the full package health analysis to learn more about the package maintenance status.
Is @top-gg/sdk safe to use?
The npm package @top-gg/sdk was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as safe to use. See the full health analysis review.
Last updated on 23 April-2024, at 10:54 (UTC).