From c94b593fd9936160fce99a901825a51e2208f3e9 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 1 Aug 2022 22:48:29 +0200 Subject: Initial commit --- init.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 init.js (limited to 'init.js') diff --git a/init.js b/init.js new file mode 100644 index 0000000..2efcb6d --- /dev/null +++ b/init.js @@ -0,0 +1,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) -- cgit v1.2.3