Consider user already opted out when they run /optout to avoid logging them

This commit is contained in:
Supositware 2024-07-10 03:40:22 +02:00
parent 4c5d879650
commit 34ab603462
2 changed files with 9 additions and 1 deletions

View file

@ -40,6 +40,10 @@ export default {
const isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } });
if (commandName === 'optout') {
isOptOut = true
}
const timestamp = new Date();
console.log(`[${timestamp.toISOString()}] \x1b[33m${ isOptOut ? 'A user' : `${userTag} (${userID})`}\x1b[0m launched command \x1b[33m${commandName}\x1b[0m using slash`);

View file

@ -302,7 +302,11 @@ export default {
const userTag = message.author.username;
const userID = message.author.id;
const isOptOut = await db.optout.findOne({ where: { userID: message.author.id } });
let isOptOut = await db.optout.findOne({ where: { userID: message.author.id } });
if (commandName === 'optout') {
isOptOut = true
}
const timestamp = new Date();
console.log(`[${timestamp.toISOString()}] \x1b[33m${ isOptOut ? 'A user' : `${userTag} (${userID})`}\x1b[0m launched command \x1b[33m${commandName}\x1b[0m using prefix`);