UNPKG

5.73 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[![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.
9
10It's intended to be used with discord.js, though you can also manually post your stats.
11
12BLAPI fully supports external and 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### With discord.js
33
34```js
35const Discord = require("discord.js");
36const blapi = require("blapi");
37
38let bot = new Discord.Client({ autoReconnect: true });
39
40// Post to the APIs every 60 minutes; you can leave out the repeat delay as it defaults to 30
41// If the interval is below 3 minutes BLAPI will not use the BotBlock API because of ratelimits
42blapi.handle(bot, apiKeys, 60);
43```
44
45### Manually, without need of Discord libraries
46
47```js
48// If you want to post sharddata you can add the optional parameters
49// shardID and shardCount should both be integers
50// shardsArray should be an integer array containing the guildcounts of the respective shards
51blapi.manualPost(guildCount, botID, apiKeys[, shardID, shardCount[, shardsArray]]);
52```
53
54### Turn on extended logging
55
56```js
57// Use this to get more detailed logging when posting
58// Errors will always be logged
59blapi.setLogging(true);
60```
61
62### Turn off the use of the BotBlock API
63
64```js
65// Use this to turn off BotBlock usage
66// By default it is set to true
67blapi.setBotblock(false);
68```
69
70### apiKeys
71
72The JSON object which includes all the API keys should look like this:
73
74```json
75{
76 "bot list domain": "API key for that bot list",
77 "bot list domain": "API key for that bot list",
78 "bot list domain": "API key for that bot list"
79}
80```
81
82an example would be:
83
84```json
85{
86 "bots.ondiscord.xyz": "dsag38_auth_token_fda6gs",
87 "discordbots.group": "qos56a_auth_token_gfd8g6"
88}
89```
90
91## Lists
92
93This is a list of all supported discord bot lists:
94
95| Domain | Supports guild count| Supports sharding | Is not extremely annoying |
96|------------------------|---------------------|-------------------|---------------------------|
97| botlist.space | ✔️ | ✔️ | ✔️ |
98| botsfordiscord.com | ✔️ | ❌ | ✔️ |
99| bots.ondiscord.xyz | ✔️ | ❌ | ✔️ |
100| discord.boats | ✔️ | ❌ | ✔️ |
101| discordboats.club | ✔️ | ❌ | ✔️ |
102| discordbotindex.com | ✔️ | ❌ | ✔️ |
103| discordbots.org | ✔️ | ✔️ | ❌ |
104| discordbotlist.com | ✔️ | ✔️ | ✔️ |
105| discordbotlist.xyz | ✔️ | ❌ | ✔️ |
106| ls.terminal.ink | ✔️ | ❌ | ✔️ |
107| discordbotsreview.tk | ✔️ | ❌ | ✔️ |
108| discordbot.world | ✔️ | ❌ | ✔️ |
109| discord.bots.gg | ✔️ | ✔️ | ✔️ |
110| discordbotslist.com | ✔️ | ❌ | ✔️ |
111| discordbots.group | ✔️ | ❌ | ✔️ |
112| discord.services | ✔️ | ❌ | ✔️ |
113| discordsbestbots.xyz | ✔️ | ✔️ | ✔️ |
114| discordsextremelist.tk | ✔️ | ❌ | ✔️ |
115| divinediscordbots.com | ✔️ | ✔️ | ✔️ |
116
117
118These lists are supported by being hardcoded, but BLAPI will always look for new additions on startup via the [BotBlock API](https://botblock.org/api/docs#lists)
119
120
121If 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.
122
123## Credit
124
125All the people who helped making BLAPI are listed in [AUTHORS](https://github.com/T0TProduction/BLAPI/blob/master/AUTHORS)
126
127By default we use the [BotBlock API](https://botblock.org/api/docs#count) to post all the data