Giter VIP home page Giter VIP logo

blapi's Introduction

BLAPI - the BotListAPI

Codacy Badge npm downloads install size dependencies Status jsDelivr

nodei

BLAPI is a package to handle posting your discord bot stats to botlists. Now typed and ready to be used in your Typescript powered bots!

It's intended to be used with discord.js v12, 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

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]]);

Turn on extended logging

// Use this to get more detailed logging when posting
// Errors will always be logged
blapi.setLogging(true);

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

A list of supported bot lists can be found here. Supported legacy Ids can be found here.

BLAPI will look for new additions on startup via the BotBlock API. This data is being updated internally on a daily basis.

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 botblock#1 on Discord.

Credit

All the people who helped making BLAPI are listed in AUTHORS

By default we use the BotBlock API to fetch and post.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.