From 6f3169d564af1d4bcde97b5ac9969b948907a005 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Tue, 11 Feb 2025 09:01:45 -0700 Subject: [PATCH] Add error msg to deletions --- deletions.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/deletions.js b/deletions.js index 07bf68e..5bc6177 100644 --- a/deletions.js +++ b/deletions.js @@ -4,8 +4,13 @@ const client = global.client const log = global.log module.exports = {}; - +var error_shown = false; module.exports.handleScheduled = async () => { + if (error_shown) return; + if (!process.env.DISCORD_GUILD) { + error_shown = true; + return log.error(`Environment variable DISCORD_GUILD is not set! Cannot handle automatic deletions. Please set this variable and restart to enable this feature.`); + } const deletions = await pool.query('SELECT * FROM discord_deletions'); if (!deletions) return; @@ -28,6 +33,11 @@ module.exports.handleScheduled = async () => { }; module.exports.findOrphans = async () => { + if (error_shown) return; + if (!process.env.DISCORD_GUILD) { + error_shown = true; + return log.error(`Environment variable DISCORD_GUILD is not set! Cannot handle automatic deletions. Please set this variable and restart to enable this feature.`); + } const users = await pool.query('SELECT * FROM discord_users'); const deletions = await pool.query('SELECT * FROM discord_deletions'); const guild = client.guilds.cache.get(process.env.DISCORD_GUILD);