mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
build: attempt to restore Netlify build preview
This commit is contained in:
+18
-14
@@ -6,24 +6,21 @@ const Discord = require("discord.js")
|
|||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const { Readable } = require("stream")
|
const { Readable } = require("stream")
|
||||||
|
|
||||||
const client = new Discord.Client()
|
function execute() {
|
||||||
|
const client = new Discord.Client()
|
||||||
|
|
||||||
const { BOT_TOKEN } = process.env
|
const { BOT_TOKEN } = process.env
|
||||||
const TPH = "244230771232079873"
|
const TPH = "244230771232079873"
|
||||||
const DESTINATION = "./users.json"
|
const DESTINATION = "./users.json"
|
||||||
|
|
||||||
if (!BOT_TOKEN) {
|
const writeS = (content, dest) => {
|
||||||
throw Error("Missing BOT_TOKEN environment variable")
|
|
||||||
}
|
|
||||||
|
|
||||||
const writeS = (content, dest) => {
|
|
||||||
const source = new Readable()
|
const source = new Readable()
|
||||||
source.push(JSON.stringify(content))
|
source.push(JSON.stringify(content))
|
||||||
source.push(null)
|
source.push(null)
|
||||||
return source.pipe(dest)
|
return source.pipe(dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
client.once("ready", async () => {
|
client.once("ready", async () => {
|
||||||
console.log("Bot ready, fetching user list...")
|
console.log("Bot ready, fetching user list...")
|
||||||
const tph = client.guilds.cache.get(TPH)
|
const tph = client.guilds.cache.get(TPH)
|
||||||
if (!tph) {
|
if (!tph) {
|
||||||
@@ -40,7 +37,14 @@ client.once("ready", async () => {
|
|||||||
console.log("Finished writing list")
|
console.log("Finished writing list")
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log("Attempting to log in...")
|
console.log("Attempting to log in...")
|
||||||
client.login(BOT_TOKEN)
|
client.login(BOT_TOKEN)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.BOT_TOKEN) {
|
||||||
|
execute()
|
||||||
|
} else {
|
||||||
|
console.log("BOT_TOKEN missing, skipping.")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user