summaryrefslogtreecommitdiff
path: root/init.js
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-08-01 22:48:29 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-08-01 22:48:29 +0200
commitc94b593fd9936160fce99a901825a51e2208f3e9 (patch)
tree913c4277b5e1d66fbb9bb9dbeb13bba127582c85 /init.js
downloadmcl2count-c94b593fd9936160fce99a901825a51e2208f3e9.tar.xz
Initial commitHEADmaster
Diffstat (limited to 'init.js')
-rw-r--r--init.js17
1 files changed, 17 insertions, 0 deletions
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)