From b7911261fdca892360054bc68c606fe3af7e293a Mon Sep 17 00:00:00 2001 From: FelixLusseau Date: Fri, 7 Jun 2024 23:10:04 +0200 Subject: [PATCH] log colors --- events/interactionCreate.js | 4 ++-- events/messageCreate.js | 2 +- utils/functions.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 0ab16fa..45e29ef 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -22,10 +22,10 @@ module.exports = { } try { - console.log(`[${new Date().toISOString()}] Executing ${interaction.commandName}`); + console.log(`\x1b[36m[${new Date().toISOString()}]\x1b[0m Executing ${interaction.commandName}`); await command.execute(bot, api, interaction); } catch (error) { - console.error(`[${new Date().toISOString()}] Error executing ${interaction.commandName}`); + console.error(`\x1b[31m[${new Date().toISOString()}]\x1b[0m Error executing ${interaction.commandName}`); console.error(error); if (interaction.replied || interaction.deferred) { await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true }); diff --git a/events/messageCreate.js b/events/messageCreate.js index 8d2f931..46e33e4 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -12,7 +12,7 @@ module.exports = { // Check if the message contains a tag and send the RoyaleAPI Profile url into the channel const regex = /\#[a-zA-Z0-9]{7,9}\b/g if (message.content.search(regex) >= 0) { - console.log(`[${new Date().toISOString()}] Tag received:`, message.content.match(regex)[0]); + console.log(`\x1b[36m[${new Date().toISOString()}]\x1b[0m Tag received:`, message.content.match(regex)[0]); placeholder = await message.channel.send("Tag received !\nSearching... ") // Send a placeholder message to show that the bot is working await message.channel.sendTyping(); const tag = message.content.match(regex)[0].substring(1).toUpperCase(); diff --git a/utils/functions.js b/utils/functions.js index 579fe08..9c88389 100644 --- a/utils/functions.js +++ b/utils/functions.js @@ -82,10 +82,10 @@ function errorEmbed(bot, interaction, channel, error) { title = "Error" } else { - myError = '[' + error.response?.headers.date + ']: Error: ' + error.response?.status + ' ' + error.response?.statusText - title = "CR-API error" + myError = error.response?.status + ' ' + error.response?.statusText + title = "CR-API Error" } - console.log(title + " : " + myError) + console.log(`\x1b[31m[${new Date().toISOString()}] ` + title + " : \x1b[0m" + myError) const errorEmbed = new EmbedBuilder() errorEmbed .setColor(0x7C0404)