Skip to content

Commit

Permalink
log colors
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixLusseau committed Jun 7, 2024
1 parent e2d71c2 commit b791126
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions events/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion events/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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... <a:Mag:1186624382982963290>") // 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();
Expand Down
6 changes: 3 additions & 3 deletions utils/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b791126

Please sign in to comment.