summaryrefslogtreecommitdiff
path: root/init.js
blob: 2efcb6db34f791c49b93e79cfb9889501969ee48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const https = require("https")
const Discord = require("discord.js")

const url = "https://content.minetest.net/api/packages/Wuzzy/mineclone2/"
const channelID = "831215776446676994"

const client = new Discord.Client({ intents: [Discord.GatewayIntentBits.Guilds] })

const update = chan => fetch(url)
	.then(res => res.json())
	.then(data => chan.setName(`🔽 ${data.downloads} Downloads`))

client.on("ready", _ => client.channels.fetch(channelID)
	.then(update)
	.then(chan => setInterval(update, 5 * 60 * 1000, chan)))

client.login(process.env.DISCORD_TOKEN)