From 49e13885fe21b188edeb4e25427d864eeb7be65d Mon Sep 17 00:00:00 2001 From: Supositware Date: Tue, 12 Dec 2023 21:45:09 +0100 Subject: [PATCH] Added timestamp --- events/client/interactionCreate.js | 10 +++------- events/client/messageCreate.js | 11 ++++------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/events/client/interactionCreate.js b/events/client/interactionCreate.js index 4bb21a8..9485744 100644 --- a/events/client/interactionCreate.js +++ b/events/client/interactionCreate.js @@ -36,12 +36,8 @@ export default { const isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } }); - if (isOptOut) { - console.log(`A user launched command \x1b[33m${commandName}\x1b[0m using slash`); - } - else { - console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m using slash`); - } + 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`); // Owner only check @@ -107,7 +103,7 @@ export default { }); if (!isOptOut) { - console.log(`\x1b[33m⤷\x1b[0m with args ${JSON.stringify(args)}`); + console.log(`[${timestamp.toISOString()}] \x1b[33m⤷\x1b[0m with args ${JSON.stringify(args)}`); } await command.execute(interaction, args, client) diff --git a/events/client/messageCreate.js b/events/client/messageCreate.js index 6286201..bf8bfb3 100644 --- a/events/client/messageCreate.js +++ b/events/client/messageCreate.js @@ -301,12 +301,9 @@ export default { const isOptOut = await db.optout.findOne({ where: { userID: message.author.id } }); - if (isOptOut) { - console.log(`A user launched command \x1b[33m${commandName}\x1b[0m using prefix`); - } - else { - console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m using prefix`); - } + 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`); + // Owner only check if (command.ownerOnly && message.author.id !== ownerId) { @@ -429,7 +426,7 @@ export default { } if (!isOptOut && argsLength > 0) { - console.log(`\x1b[33m⤷\x1b[0m with args ${JSON.stringify(args)}`); + console.log(`[${timestamp.toISOString()}]\x1b[33m⤷\x1b[0m with args ${JSON.stringify(args)}`); } await command.execute(message, args, client)