Script to update bots.gg stats

pull/1/head
Supositware 1 year ago
parent 118954f795
commit 0ae54bbbca

@ -11,3 +11,5 @@ twiToken=TwitterToken
twiTokenSecret=TwitterSecretToken
twiChannel=ChannelWhereJustTheTwitterLinkAreSent
twiLogChannel=ChannelWhereTheDetailedInfoOfTheCommandIsSent
botsggToken=APITokenForBots.gg
botsggEndpoint=https://discord.bots.gg/api/v1

@ -0,0 +1,30 @@
import dotenv from 'dotenv';
import fetch from 'node-fetch';
import { Client, GatewayIntentBits } from 'discord.js';
dotenv.config();
const { botsggToken, botsggEndpoint, token } = process.env;
const client = new Client({
intents: [GatewayIntentBits.Guilds],
});
await client.login(token);
const body = {
guildCount: client.guilds.cache.size,
};
console.log(body);
const response = await fetch(`${botsggEndpoint}/bots/${client.user.id}/stats`, {
method: 'post',
body: JSON.stringify(body),
headers: { 'Authorization': botsggToken, 'Content-Type': 'application/json' },
});
const data = await response.json();
console.log(data);
process.exit();
Loading…
Cancel
Save