GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - botblock/BLAPI: A package to handle posting your discord bot stats to all botlists [Typescript (and JavaScript) - maintained by @maybeanerd]

BranchesTags
Open more actions menu

Latest commit

 

History

766 Commits
766 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.vscode
.vscode
 
 
src
src
 
 
.all-contributorsrc
.all-contributorsrc
 
 
.editorconfig
.editorconfig
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.jsbeautifyrc
.jsbeautifyrc
 
 
.npmrc
.npmrc
 
 
.nvmrc
.nvmrc
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
renovate.json
renovate.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

BLAPI - the BotListAPI

All Contributors

npm downloads install size jsDelivr

nodei

BLAPI is a fully typed package to handle posting your discord bot stats to botlists.

It's intended to be used with discord.js v13 or v14, though you can also manually post your stats.

BLAPI fully supports external and discord.js internal sharding with and without the use of the BotBlock API.

Installation

NPM (recommended)

npm i blapi

Yarn

yarn add blapi

Usage

The list of all supported bot lists and their respective names for the apiKeys object are listed below

Import the lib via ES6 or commonJS modules

// ES6
import * as blapi from "blapi";
// or
import { handle } from "blapi"; // Just the functions you want to use
// or commonJS
const blapi = require("blapi");

With discord.js (version 13.x or 14.x)

import Discord from "discord.js";

const bot = new Discord.Client();

// Post to the APIs every 60 minutes; you can leave out the repeat delay as it defaults to 30
// If the interval is below 3 minutes BLAPI will not use the BotBlock API because of ratelimits
blapi.handle(bot, apiKeys, 60);

Manually, without need of Discord libraries

// If you want to post sharddata you can add the optional parameters
// shardID and shardCount should both be integers
// shardsArray should be an integer array containing the guildcounts of the respective shards
blapi.manualPost(guildCount, botID, apiKeys[, shardID, shardCount[, shardsArray]]);

Logging Options

// Use this to set the level of logs you're interested in
// By default, warnings and errors will be logged
blapi.setLogging({
  logLevel: LogLevel.All
});
// If you have your own logger that you want to use pass it to BLAPI like this:
// Important: The logger needs to include the following methods: log.info(), log.warn() and log.error()
blapi.setLogging({
  logger: yourCustomLogger
})

Turn off the use of the BotBlock API

// Use this to turn off BotBlock usage
// By default it is set to true
blapi.setBotblock(false);

apiKeys

The JSON object which includes all the API keys should look like this:

{
  "bot list domain": "API key for that bot list",
  "bot list domain": "API key for that bot list"
}

an example would be:

{
  "bots.ondiscord.xyz": "dsag38_auth_token_fda6gs",
  "discordbots.group": "qos56a_auth_token_gfd8g6"
}

Lists

BLAPI automatically supports posting to all lists that are listed on botblock. For the rare case that their API is down, BLAPI has an integrated fallback list. This list is kept somewhat up to date inside the repository, but once BLAPI is running in your bot, it will update the internal fallback on a daily basis.

Supported legacy Ids are supported in a similar fashion. BLAPI supports all legacy IDs listed on botblock. The fallback legacy IDs can be found here, and they are also internally updated on a daily basis once you have BLAPI up and running.

If at any time you find other bot lists have added an API to post your guildcount, let us know on this repo or by contacting #1 on Discord. In general, if a list is not listed on BotBlock, the best way to get it added is to directly join the BotBlock Discord server and request it there.

Development

To work on BLAPI, install the node version specified in .nvmrc. If you are using nvm on a unix based system, this can be done quickly by using nvm use and if the version is not installed, nvm install. Install all the dependencies following the package-lock via npm ci.

This repo enforces eslint rules which are included in the installation.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Sebastian Di Luzio

💻 🚧 📖

advaith

📖 🐛

Matt Cowley

📖 💻

Benedikt Buhles

💻

Glenn

💻 🐛

Jonah Snider

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

A package to handle posting your discord bot stats to all botlists [Typescript (and JavaScript) - maintained by @maybeanerd]

Topics

apiapikeysblapibot-listsbotblock-apibotlistbotlistapidiscorddiscord-apidiscord-botdiscord-bot-statsdiscord-botsdiscord-jsdiscordbotdiscordbotlistdiscordjshacktoberfeststatstypescripttypescript-library

Resources

Readme
MIT license

Code of conduct

Code of conduct
Activity
Custom properties

Stars

35 stars

Watchers

2 watching

Forks

13 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.