1

POST to https://discordbotlist.com/ API using DiscordJS and Snekfetch

Function JavaScript 6 revisions 71 a month ago a month ago
// POST to https://discordbotlist.com/ API using DiscordJS and Snekfetch
// JavaScript
// bot = new DiscordJS.Client()

const { post } = require('snekfetch')
const updateBotList = async () => {
    console.log('Updating DBL stats')

    const { body: reply } = await post(`https://discordbotlist.com/api/bots/${process.env.BOT_ID}/stats`)
        .set("Authorization", `Bot ${process.env.DBL_TOKEN}`)
        .send({
            shard_id: 0,
            guilds: bot.guilds.size,
            users: bot.users.size,
            voice_connections: bot.voiceConnections.size
        })

    return (reply)
}

const responseFromAPI = await updateBotList()

Go post those nice bot stats of yours