]> git.lizzy.rs Git - mcl2count.git/blob - init.js
Initial commit
[mcl2count.git] / init.js
1 const https = require("https")
2 const Discord = require("discord.js")
3
4 const url = "https://content.minetest.net/api/packages/Wuzzy/mineclone2/"
5 const channelID = "831215776446676994"
6
7 const client = new Discord.Client({ intents: [Discord.GatewayIntentBits.Guilds] })
8
9 const update = chan => fetch(url)
10         .then(res => res.json())
11         .then(data => chan.setName(`🔽 ${data.downloads} Downloads`))
12
13 client.on("ready", _ => client.channels.fetch(channelID)
14         .then(update)
15         .then(chan => setInterval(update, 5 * 60 * 1000, chan)))
16
17 client.login(process.env.DISCORD_TOKEN)