Skip to content

Commit 3995774

Browse files
committed
fix type errors with new botlist data
1 parent 42e3c55 commit 3995774

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/blapi.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Declaring global fails exporting some types, so TS will fail in that case */
99
type listDataType = {
1010
[listname: string]: {
1111
api_docs: string | null;
12-
api_post: string;
13-
api_field: string;
12+
api_post: string | null;
13+
api_field: string | null;
1414
api_shard_id: string | null;
1515
api_shard_count: string | null;
1616
api_shards: string | null;
@@ -154,6 +154,9 @@ async function postToAllLists(
154154
Object.entries(listData).forEach(([listname]) => {
155155
if (apiKeys[listname] && listData[listname].api_post) {
156156
const list = listData[listname];
157+
if (!list.api_post || !list.api_field) {
158+
return;
159+
}
157160
const apiPath = list.api_post.replace(':id', client_id);
158161
const sendObj: { [key: string]: any } = {};
159162
sendObj[list.api_field] = server_count;

src/fallbackListData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export default {
6767
api_shard_count: 'shardCount',
6868
api_shards: null,
6969
api_get: 'https://discord.bots.gg/api/v1/bots/:id',
70-
api_all: 'https://discord.bots.gg/api/v1/bots?limit=100&sort=guildcount&order=desc',
70+
api_all:
71+
'https://discord.bots.gg/api/v1/bots?limit=100&sort=guildcount&order=desc',
7172
},
7273
'discordapps.dev': {
7374
api_docs: 'https://discordapps.dev/en-GB/posts/docs/api-v2/',

0 commit comments

Comments
 (0)