diff --git a/src/commands/player/loop.js b/src/commands/player/loop.js index e903516..b46fd6d 100644 --- a/src/commands/player/loop.js +++ b/src/commands/player/loop.js @@ -96,7 +96,9 @@ module.exports = { queue.setRepeatMode(mode); - if (!queue.repeatMode === mode) { + // switch(queue.repeatMode) instead of multiple if statements + + if (queue.repeatMode !== mode) { logger.warn( 'Failed to change loop mode. After setting queue repeat mode, the value was not the same as input.' ); @@ -109,6 +111,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... Failed to change loop mode!**\nI tried to change the loop mode to \`${modeUserString}\`, but something went wrong.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect or the issue persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } diff --git a/src/commands/player/lyrics.js b/src/commands/player/lyrics.js index de5d6c6..7f54c76 100644 --- a/src/commands/player/lyrics.js +++ b/src/commands/player/lyrics.js @@ -8,6 +8,12 @@ const { lyricsExtractor } = require('@discord-player/extractor'); const recentQueries = new Map(); +const loggerTempplate = require('../../services/logger').child({ + source: 'lyrics.js', + module: 'slashCommand', + name: '/lyrics' +}); + module.exports = { isNew: false, isBeta: false, @@ -26,10 +32,7 @@ module.exports = { .setAutocomplete(true) ), autocomplete: async ({ interaction, executionId }) => { - const logger = require('../../services/logger').child({ - source: 'lyrics.js', - module: 'slashCommand', - name: '/lyrics', + const logger = loggerTempplate.child({ executionId: executionId, shardId: interaction.guild.shardId, guildId: interaction.guild.id @@ -89,10 +92,7 @@ module.exports = { return interaction.respond(response); }, execute: async ({ interaction, executionId }) => { - const logger = require('../../services/logger').child({ - source: 'lyrics.js', - module: 'slashCommand', - name: '/lyrics', + const logger = loggerTempplate.child({ executionId: executionId, shardId: interaction.guild.shardId, guildId: interaction.guild.id diff --git a/src/commands/player/play.js b/src/commands/player/play.js index 9104bd5..fa6dd5d 100644 --- a/src/commands/player/play.js +++ b/src/commands/player/play.js @@ -11,6 +11,12 @@ const { useMainPlayer, useQueue } = require('discord-player'); const recentQueries = new Map(); +const loggerTempplate = require('../../services/logger').child({ + source: 'play.js', + module: 'slashCommand', + name: '/play' +}); + module.exports = { isNew: false, isBeta: false, @@ -29,10 +35,7 @@ module.exports = { .setAutocomplete(true) ), autocomplete: async ({ interaction, executionId }) => { - const logger = require('../../services/logger').child({ - source: 'play.js', - module: 'slashCommand', - name: '/play', + const logger = loggerTempplate.child({ executionId: executionId, shardId: interaction.guild.shardId, guildId: interaction.guild.id @@ -84,10 +87,7 @@ module.exports = { return interaction.respond(response); }, execute: async ({ interaction, executionId }) => { - const logger = require('../../services/logger').child({ - source: 'play.js', - module: 'slashCommand', - name: '/play', + const logger = loggerTempplate.child({ executionId: executionId, shardId: interaction.guild.shardId, guildId: interaction.guild.id @@ -158,6 +158,7 @@ module.exports = { try { logger.debug(`Attempting to add track with player.play(). Query: '${query}'.`); + ({ track } = await player.play(interaction.member.voice.channel, searchResult, { requestedBy: interaction.user, nodeOptions: { @@ -227,6 +228,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nAfter finding a result, I was unable to retrieve audio for the track.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } @@ -242,6 +244,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nSomething unexpected happened and the operation was cancelled.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } @@ -258,6 +261,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nSomething unexpected happened and it was not possible to start playing the track. This could happen if the voice connection is lost or queue is destroyed while adding the track.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } @@ -280,6 +284,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nThere was an issue adding this track to the queue.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } diff --git a/src/commands/system/reload.js b/src/commands/system/reload.js index 6598597..40c2e6c 100644 --- a/src/commands/system/reload.js +++ b/src/commands/system/reload.js @@ -51,6 +51,7 @@ module.exports = { `**${embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to reload commands across shards.` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } diff --git a/src/commands/system/shards.js b/src/commands/system/shards.js index 0241e80..d01d4b8 100644 --- a/src/commands/system/shards.js +++ b/src/commands/system/shards.js @@ -115,6 +115,7 @@ module.exports = { `**${embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to fetch player statistics and client values from shards.` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } diff --git a/src/events/interactions/interactionCreate.js b/src/events/interactions/interactionCreate.js index f9bba6a..faac0ac 100644 --- a/src/events/interactions/interactionCreate.js +++ b/src/events/interactions/interactionCreate.js @@ -100,6 +100,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to execute this command.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } else { @@ -111,6 +112,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to execute this command.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } diff --git a/src/events/player/generalError.js b/src/events/player/generalError.js index afa58cd..a011d97 100644 --- a/src/events/player/generalError.js +++ b/src/events/player/generalError.js @@ -31,6 +31,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue related to the queue or current track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); @@ -45,6 +46,7 @@ module.exports = { `\n\n<@${systemOptions.systemUserId}>` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } diff --git a/src/events/player/playerError.js b/src/events/player/playerError.js index 5948f59..c017669 100644 --- a/src/events/player/playerError.js +++ b/src/events/player/playerError.js @@ -31,6 +31,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue while streaming the track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); @@ -45,6 +46,7 @@ module.exports = { `\n\n<@${systemOptions.systemUserId}>` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); } diff --git a/src/events/player/playerSkip.js b/src/events/player/playerSkip.js index 5abdc60..2b7c6cd 100644 --- a/src/events/player/playerSkip.js +++ b/src/events/player/playerSkip.js @@ -31,6 +31,7 @@ module.exports = { `**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue while loading stream for the track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); @@ -45,6 +46,7 @@ module.exports = { `\n\n<@${systemOptions.systemUserId}>` ) .setColor(embedOptions.colors.error) + .setFooter({ text: `Execution ID: ${executionId}` }) ] }); }