Add error msg to deletions
This commit is contained in:
parent
d9b52d841a
commit
6f3169d564
12
deletions.js
12
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);
|
||||
|
|
Loading…
Reference in a new issue