UNPKG

6 kBMarkdownView Raw
1# BLAPI - the BotListAPI
2
3[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ebd62ee46cd84964975ae65ac9462fa1)](https://app.codacy.com/app/T0TProduction/BLAPI?utm_source=github.com&utm_medium=referral&utm_content=T0TProduction/BLAPI&utm_campaign=Badge_Grade_Dashboard)
4[![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)
5[![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)
6
7[![nodei](https://nodei.co/npm/blapi.png)](https://nodei.co/npm/blapi/)
8
9BLAPI is a package to handle posting your discord bot stats to botlists.
10
11It's intended to be used with discord.js, though you can also manually post your stats.
12
13BLAPI fully supports external and discord.js internal sharding with and without the use of the [BotBlock API](https://botblock.org/api/docs#count).
14
15## Installation
16
17### NPM (recommended)
18
19```bash
20npm i blapi
21```
22
23### Yarn
24
25```bash
26yarn add blapi
27```
28
29## Usage
30
31The list of all supported bot lists and their respective names for the apiKeys object are listed [below](https://github.com/T0TProduction/BLAPI#lists)
32
33### With discord.js
34
35```js
36const Discord = require("discord.js");
37const blapi = require("blapi");
38
39let bot = new Discord.Client({ autoReconnect: true });
40
41// Post to the APIs every 60 minutes; you can leave out the repeat delay as it defaults to 30
42// If the interval is below 3 minutes BLAPI will not use the BotBlock API because of ratelimits
43blapi.handle(bot, apiKeys, 60);
44```
45
46### Manually, without need of Discord libraries
47
48```js
49// If you want to post sharddata you can add the optional parameters
50// shardID and shardCount should both be integers
51// shardsArray should be an integer array containing the guildcounts of the respective shards
52blapi.manualPost(guildCount, botID, apiKeys[, shardID, shardCount[, shardsArray]]);
53```
54
55### Turn on extended logging
56
57```js
58// Use this to get more detailed logging when posting
59// Errors will always be logged
60blapi.setLogging(true);
61```
62
63### Turn off the use of the BotBlock API
64
65```js
66// Use this to turn off BotBlock usage
67// By default it is set to true
68blapi.setBotblock(false);
69```
70
71### apiKeys
72
73The JSON object which includes all the API keys should look like this:
74
75```json
76{
77 "bot list domain": "API key for that bot list",
78 "bot list domain": "API key for that bot list",
79 "bot list domain": "API key for that bot list"
80}
81```
82
83an example would be:
84
85```json
86{
87 "bots.ondiscord.xyz": "dsag38_auth_token_fda6gs",
88 "discordbots.group": "qos56a_auth_token_gfd8g6"
89}
90```
91
92## Lists
93
94These 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.
95
96| Domain | Supports guild count| Supports sharding | Is not extremely annoying |
97|------------------------|---------------------|-------------------|---------------------------|
98| botlist.space | ✔️ | ✔️ | ✔️ |
99| botsfordiscord.com | ✔️ | ❌ | ✔️ |
100| bots.ondiscord.xyz | ✔️ | ❌ | ✔️ |
101| discord.boats | ✔️ | ❌ | ✔️ |
102| discordapps.dev | ✔️ | ❌ | ✔️ |
103| discordboats.club | ✔️ | ❌ | ✔️ |
104| discordbotindex.com | ✔️ | ❌ | ✔️ |
105| discordbots.org | ✔️ | ✔️ | ❌ |
106| discordbotlist.com | ✔️ | ✔️ | ✔️ |
107| discordbotlist.xyz | ✔️ | ❌ | ✔️ |
108| discordbotreviews.xyz | ✔️ | ❌ | ✔️ |
109| discordbot.world | ✔️ | ✔️ | ✔️ |
110| discord.bots.gg | ✔️ | ✔️ | ✔️ |
111| discordbotslist.com | ✔️ | ❌ | ✔️ |
112| discordbots.group | ✔️ | ❌ | ✔️ |
113| discord.services | ✔️ | ❌ | ✔️ |
114| discordsbestbots.xyz | ✔️ | ✔️ | ✔️ |
115| discordsextremelist.tk | ✔️ | ❌ | ✔️ |
116| divinediscordbots.com | ✔️ | ✔️ | ✔️ |
117
118
119Discordbots.org is still supported even though they blacklisted our API fetching service of choice, BotBlock.
120
121
122If 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.
123
124## Credit
125
126All the people who helped making BLAPI are listed in [AUTHORS](https://github.com/T0TProduction/BLAPI/blob/master/AUTHORS)
127
128By default we use the [BotBlock API](https://botblock.org/api/docs#count) to fetch and post.