feat(utils): don't asks for grinders if rewards are disabled
Some checks failed
Build and Push Docker Image / build (push) Failing after 18s

This commit is contained in:
Pihkaal
2025-12-21 11:49:48 +01:00
parent d3561c019d
commit 1cbd752977

View File

@@ -12,6 +12,8 @@ export const askForGrinders = async (quest: QuestResult, client: Client) => {
return questLogger.fatal("Invalid 'DISCORD_ADMIN_CHANNEL'"); return questLogger.fatal("Invalid 'DISCORD_ADMIN_CHANNEL'");
} }
let exclude: string[] = [];
if (env.QUEST_REWARDS) {
const top10 = quest.participants const top10 = quest.participants
.filter((x) => !env.QUEST_EXCLUDE.includes(x.username)) .filter((x) => !env.QUEST_EXCLUDE.includes(x.username))
.sort((a, b) => b.xp - a.xp) .sort((a, b) => b.xp - a.xp)
@@ -99,10 +101,12 @@ export const askForGrinders = async (quest: QuestResult, client: Client) => {
return questLogger.fatal("Answer was 'null', this should be unreachable"); return questLogger.fatal("Answer was 'null', this should be unreachable");
} }
const exclude = answer exclude = answer
.split(",") .split(",")
.map((x) => x.trim()) .map((x) => x.trim())
.filter(Boolean); .filter(Boolean);
}
const embed = await makeResultEmbed(quest, [ const embed = await makeResultEmbed(quest, [
...env.QUEST_EXCLUDE, ...env.QUEST_EXCLUDE,
...exclude, ...exclude,
@@ -116,6 +120,8 @@ export const askForGrinders = async (quest: QuestResult, client: Client) => {
return questLogger.fatal("Invalid 'DISCORD_REWARDS_CHANNEL'"); return questLogger.fatal("Invalid 'DISCORD_REWARDS_CHANNEL'");
} }
if (env.QUEST_EXCLUDE) {
await adminChannel.send("Envoyé !"); await adminChannel.send("Envoyé !");
}
questLogger.info(`Results posted at: ${new Date().toISOString()}`); questLogger.info(`Results posted at: ${new Date().toISOString()}`);
}; };