UNPKG

5.89 kBMarkdownView Raw
1# BLAPI - the BotListAPI
2
3[![DeepScan grade](https://deepscan.io/api/teams/2846/projects/4250/branches/34642/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=2846&pid=4250&bid=34642)
4[![dependencies Status](https://david-dm.org/T0TProduction/BLAPI/status.svg)](https://david-dm.org/T0TProduction/BLAPI) [![npm downloads](https://img.shields.io/npm/dt/blapi.svg)](https://nodei.co/npm/blapi/) [![install size](https://packagephobia.now.sh/badge?p=blapi)](https://packagephobia.now.sh/result?p=blapi) [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/blapi/badge?style=rounded)](https://www.jsdelivr.com/package/npm/blapi)
5
6[![nodei](https://nodei.co/npm/blapi.png)](https://nodei.co/npm/blapi/)
7
8BLAPI is a package to handle posting your discord bot stats to botlists. Now typed and ready to be used in your Typescript powered bots!
9
10It's intended to be used with discord.js, though you can also manually post your stats.
11
12BLAPI fully supports external [and temporarily disabled: discord.js internal] sharding with and without the use of the [BotBlock API](https://botblock.org/api/docs#count).
13
14## Installation
15
16### NPM (recommended)
17
18```bash
19npm i blapi
20```
21
22### Yarn
23
24```bash
25yarn add blapi
26```
27
28## Usage
29
30The list of all supported bot lists and their respective names for the apiKeys object are listed [below](https://github.com/T0TProduction/BLAPI#lists)
31
32### Import the lib via ES6 or commonJS modules
33
34```js
35// ES6
36import * as blapi from "blapi";
37// or
38import { handle } from "blapi"; // Just the functions you want to use
39// or commonJS
40const blapi = require("blapi");
41```
42
43### With discord.js
44
45```js
46import Discord from "discord.js";
47
48const bot = new Discord.Client();
49
50// Post to the APIs every 60 minutes; you can leave out the repeat delay as it defaults to 30
51// If the interval is below 3 minutes BLAPI will not use the BotBlock API because of ratelimits
52blapi.handle(bot, apiKeys, 60);
53```
54
55### Manually, without need of Discord libraries
56
57```js
58// If you want to post sharddata you can add the optional parameters
59// shardID and shardCount should both be integers
60// shardsArray should be an integer array containing the guildcounts of the respective shards
61blapi.manualPost(guildCount, botID, apiKeys[, shardID, shardCount[, shardsArray]]);
62```
63
64### Turn on extended logging
65
66```js
67// Use this to get more detailed logging when posting
68// Errors will always be logged
69blapi.setLogging(true);
70```
71
72### Turn off the use of the BotBlock API
73
74```js
75// Use this to turn off BotBlock usage
76// By default it is set to true
77blapi.setBotblock(false);
78```
79
80### apiKeys
81
82The JSON object which includes all the API keys should look like this [not typed yet]:
83
84```json
85{
86 "bot list domain": "API key for that bot list",
87 "bot list domain": "API key for that bot list",
88 "bot list domain": "API key for that bot list"
89}
90```
91
92an example would be:
93
94```json
95{
96 "bots.ondiscord.xyz": "dsag38_auth_token_fda6gs",
97 "discordbots.group": "qos56a_auth_token_gfd8g6"
98}
99```
100
101## Lists
102
103These lists are supported by being hardcoded, but BLAPI will look for new additions on startup via the [BotBlock API](https://botblock.org/api/docs#lists). BLAPI will try to update its API data daily.
104
105| Domain | Supports guild count| Supports sharding | Is not extremely annoying |
106|------------------------|---------------------|-------------------|---------------------------|
107| botlist.space | ✔️ | ✔️ | ✔️ |
108| botsfordiscord.com | ✔️ | ❌ | ✔️ |
109| bots.ondiscord.xyz | ✔️ | ❌ | ✔️ |
110| discord.boats | ✔️ | ❌ | ✔️ |
111| discordapps.dev | ✔️ | ❌ | ✔️ |
112| discordboats.club | ✔️ | ❌ | ✔️ |
113| discordbotindex.com | ✔️ | ❌ | ✔️ |
114| discordbots.org | ✔️ | ✔️ | ❌ |
115| discordbotlist.com | ✔️ | ✔️ | ✔️ |
116| discordbotlist.xyz | ✔️ | ❌ | ✔️ |
117| discordbotreviews.xyz | ✔️ | ❌ | ✔️ |
118| discordbot.world | ✔️ | ✔️ | ✔️ |
119| discord.bots.gg | ✔️ | ✔️ | ✔️ |
120| discordbotslist.com | ✔️ | ❌ | ✔️ |
121| discordbots.group | ✔️ | ❌ | ✔️ |
122| discord.services | ✔️ | ❌ | ✔️ |
123| discordsbestbots.xyz | ✔️ | ✔️ | ✔️ |
124| discordsextremelist.tk | ✔️ | ❌ | ✔️ |
125| divinediscordbots.com | ✔️ | ✔️ | ✔️ |
126
127
128Discordbots.org is still supported even though they blacklisted our API fetching service of choice, BotBlock.
129
130
131If 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 T0TProduction#0001 on Discord.
132
133## Credit
134
135All the people who helped making BLAPI are listed in [AUTHORS](https://github.com/T0TProduction/BLAPI/blob/master/AUTHORS)
136
137By default we use the [BotBlock API](https://botblock.org/api/docs#count) to fetch and post.