Merge pull request #374 from the-programmers-hangout/build-attempt-to-restore-netlify-build-preview

build: attempt to restore Netlify build preview
This commit is contained in:
Jean-Philippe Sirois
2020-11-09 17:37:38 -05:00
committed by GitHub
+20 -14
View File
@@ -6,24 +6,21 @@ const Discord = require("discord.js")
const fs = require("fs")
const { Readable } = require("stream")
const client = new Discord.Client()
function execute() {
const client = new Discord.Client()
const { BOT_TOKEN } = process.env
const TPH = "244230771232079873"
const DESTINATION = "./users.json"
const { BOT_TOKEN } = process.env
const TPH = "244230771232079873"
const DESTINATION = "./users.json"
if (!BOT_TOKEN) {
throw Error("Missing BOT_TOKEN environment variable")
}
const writeS = (content, dest) => {
const writeS = (content, dest) => {
const source = new Readable()
source.push(JSON.stringify(content))
source.push(null)
return source.pipe(dest)
}
}
client.once("ready", async () => {
client.once("ready", async () => {
console.log("Bot ready, fetching user list...")
const tph = client.guilds.cache.get(TPH)
if (!tph) {
@@ -40,7 +37,16 @@ client.once("ready", async () => {
console.log("Finished writing list")
process.exit(0)
})
})
})
console.log("Attempting to log in...")
client.login(BOT_TOKEN)
console.log("Attempting to log in...")
client.login(BOT_TOKEN)
}
// TODO: restore me once intents are implemented
if (process.env.BOT_TOKEN) {
console.log("skipped until intents are implemented")
// execute()
} else {
console.log("BOT_TOKEN missing, skipping.")
}