Getting Started
Setup and tokens
Constructing Botlists and providing tokens.
the usual setup
import { Client } from 'discord.js';
import { Botlists } from '@potenfyrstudios/discord-botlists';
const client = new Client({ intents: ['Guilds'] });
const lists = new Botlists({
client, // optional: discord.js or Eris client
tokens: {
'top.gg': process.env.TOPGG_TOKEN,
'discordbotlist.com': process.env.DBL_TOKEN,
},
webhook: {
port: 8080, // default 8080
path: '/discord-botlists', // default
secret: process.env.WEBHOOK_SECRET,
},
startupStatusCheck: true, // print the status table on first postStats
});Token resolution order
- Environment variables: DBL_<LIST-ID-UPPERCASED>, for example DBL_TOP.GG.
- The tokens map in the constructor overrides env per list id.
- Lists without a token are skipped by postStats and reported as skipped, never as failures.
| Option | Type | Default | Description |
|---|---|---|---|
botId | string | client.user.id | Your bot application id |
client | BotClientLike | null | discord.js, Eris or Oceanic client for auto stats |
statsProvider | StatsProvider | null | Provide stats yourself: any framework or none |
tokens | Record<string,string> | env DBL_* | Per list tokens, overrides env |
authHeaders | Record<string,string> | per list default | Override the auth header name per list |
lists | BotlistRecord[] | [] | Add custom or self-hosted lists |
webhook | WebhookOptions | {} | Webhook server config |
fetchOptions | FetchOptions | timeout 10s, 2 retries | Applied to every request |
disableStatusCheck | boolean | false | Skip pre-request status lookups |
startupStatusCheck | boolean | false | Probe and print the status table on first post |