From 775d942e2d472668184d9ed93ab9a30b4a1a52d1 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Thu, 31 Aug 2023 13:46:25 +0200 Subject: [PATCH] solve build errors --- src/events/client/disconnect.ts | 4 ++-- src/events/client/ready.ts | 4 ++-- src/events/client/reconnecting.ts | 4 ++-- src/events/player/generalError.ts | 8 +++---- src/events/player/playerError.ts | 8 +++---- src/events/player/playerSkip.ts | 8 +++---- src/handlers/interactionErrorHandler.ts | 4 ++-- src/interactions/commands/player/test.ts | 24 ------------------- src/interactions/commands/system/reload.ts | 15 +++++++++--- .../components/filters-disable-button.ts | 6 ++--- .../components/filters-select-menu.ts | 2 +- .../components/nowplaying-skip-button.ts | 16 ++++++------- src/utils/validation/permissionValidator.ts | 8 +++---- src/utils/validation/queueValidator.ts | 12 +++++----- .../validation/systemCommandValidator.ts | 4 ++-- src/utils/validation/voiceChannelValidator.ts | 8 +++---- 16 files changed, 60 insertions(+), 75 deletions(-) delete mode 100644 src/interactions/commands/player/test.ts diff --git a/src/events/client/disconnect.ts b/src/events/client/disconnect.ts index 8dfc757..b7217dd 100644 --- a/src/events/client/disconnect.ts +++ b/src/events/client/disconnect.ts @@ -35,10 +35,10 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `${this.embedOptions.icons.warning} **${client.user?.tag}** is **\`disconnected\`**!` + + `${embedOptions.icons.warning} **${client.user?.tag}** is **\`disconnected\`**!` + `\n\n<@${systemOptions.systemUserId}>` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); } diff --git a/src/events/client/ready.ts b/src/events/client/ready.ts index 1bb7282..7e89f70 100644 --- a/src/events/client/ready.ts +++ b/src/events/client/ready.ts @@ -50,9 +50,9 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.success} All shards ready**\n**${client.user?.tag}** is now **\`online\`**!` + `**${embedOptions.icons.success} All shards ready**\n**${client.user?.tag}** is now **\`online\`**!` ) - .setColor(this.embedOptions.colors.success) + .setColor(embedOptions.colors.success) ] }); } diff --git a/src/events/client/reconnecting.ts b/src/events/client/reconnecting.ts index 68be092..640191e 100644 --- a/src/events/client/reconnecting.ts +++ b/src/events/client/reconnecting.ts @@ -36,10 +36,10 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `${this.embedOptions.icons.warning} **${client.user?.tag}** is **\`reconnecting\`**!` + + `${embedOptions.icons.warning} **${client.user?.tag}** is **\`reconnecting\`**!` + `\n\n<@${systemOptions.systemUserId}>` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); } diff --git a/src/events/player/generalError.ts b/src/events/player/generalError.ts index 3baf3ff..2dc5313 100644 --- a/src/events/player/generalError.ts +++ b/src/events/player/generalError.ts @@ -31,9 +31,9 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**${this.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](${this.botOptions.serverInviteUrl})**._` + `**${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(this.embedOptions.colors.error) + .setColor(embedOptions.colors.error) .setFooter({ text: `Execution ID: ${executionId}` }) ] }); @@ -47,10 +47,10 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `${this.embedOptions.icons.error} **player.events.on('error')**\nExecution id: ${executionId}\n${error.message}` + + `${embedOptions.icons.error} **player.events.on('error')**\nExecution id: ${executionId}\n${error.message}` + `\n\n<@${systemOptions.systemUserId}>` ) - .setColor(this.embedOptions.colors.error) + .setColor(embedOptions.colors.error) .setFooter({ text: `Execution ID: ${executionId}` }) ] }); diff --git a/src/events/player/playerError.ts b/src/events/player/playerError.ts index 44a13fc..e8a1b10 100644 --- a/src/events/player/playerError.ts +++ b/src/events/player/playerError.ts @@ -31,9 +31,9 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**${this.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](${this.botOptions.serverInviteUrl})**._` + `**${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(this.embedOptions.colors.error) + .setColor(embedOptions.colors.error) .setFooter({ text: `Execution ID: ${executionId}` }) ] }); @@ -47,10 +47,10 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `${this.embedOptions.icons.error} **player.events.on('playerError')**\nExecution id: ${executionId}\n${error.message}` + + `${embedOptions.icons.error} **player.events.on('playerError')**\nExecution id: ${executionId}\n${error.message}` + `\n\n<@${systemOptions.systemUserId}>` ) - .setColor(this.embedOptions.colors.error) + .setColor(embedOptions.colors.error) .setFooter({ text: `Execution ID: ${executionId}` }) ] }); diff --git a/src/events/player/playerSkip.ts b/src/events/player/playerSkip.ts index c630f38..0755285 100644 --- a/src/events/player/playerSkip.ts +++ b/src/events/player/playerSkip.ts @@ -32,9 +32,9 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**${this.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](${this.botOptions.serverInviteUrl})**._` + `**${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(this.embedOptions.colors.error) + .setColor(embedOptions.colors.error) .setFooter({ text: `Execution ID: ${executionId}` }) ] }); @@ -48,10 +48,10 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `${this.embedOptions.icons.error} **player.events.on('playerSkip')**\nExecution id: ${executionId}\n${track.url}` + + `${embedOptions.icons.error} **player.events.on('playerSkip')**\nExecution id: ${executionId}\n${track.url}` + `\n\n<@${systemOptions.systemUserId}>` ) - .setColor(this.embedOptions.colors.error) + .setColor(embedOptions.colors.error) .setFooter({ text: `Execution ID: ${executionId}` }) ] }); diff --git a/src/handlers/interactionErrorHandler.ts b/src/handlers/interactionErrorHandler.ts index 5ed5262..3f02b5c 100644 --- a/src/handlers/interactionErrorHandler.ts +++ b/src/handlers/interactionErrorHandler.ts @@ -27,9 +27,9 @@ export const handleError = async ( embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to perform this action. You can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._` + `**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to perform this action. You can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` ) - .setColor(this.embedOptions.colors.error) + .setColor(embedOptions.colors.error) .setFooter({ text: `Execution ID: ${executionId}` }) ] }; diff --git a/src/interactions/commands/player/test.ts b/src/interactions/commands/player/test.ts deleted file mode 100644 index eeff5d2..0000000 --- a/src/interactions/commands/player/test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { - BaseSlashCommandInteraction, - BaseSlashCommandParams, - BaseSlashCommandReturnType -} from '../../../types/interactionTypes'; - -class TestCommand extends BaseSlashCommandInteraction { - constructor() { - const data = new SlashCommandBuilder() - .setName('test') - .setDescription('This is a test command description lorem ipsum.'); - super(data); - } - - async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType { - const { executionId, interaction } = params; - const logger = this.getLogger(this.commandName, executionId, interaction); - - // logic - } -} - -export default new TestCommand(); diff --git a/src/interactions/commands/system/reload.ts b/src/interactions/commands/system/reload.ts index 14570f6..a134b79 100644 --- a/src/interactions/commands/system/reload.ts +++ b/src/interactions/commands/system/reload.ts @@ -1,4 +1,4 @@ -import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; +import { ApplicationCommandOption, ApplicationCommandOptionData, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { ExtendedClient } from '../../../types/clientTypes'; import { BaseSlashCommandInteraction, @@ -50,8 +50,17 @@ class ReloadCommand extends BaseSlashCommandInteraction { }); } - const commands: string[] | undefined = client!.commands?.map((command) => { - const params: string = command.data.options[0] ? `**\`${command.data.options[0].name}\`**` + ' ' : ''; + const commands: string[] | undefined = client!.commands?.map((command: BaseSlashCommandInteraction) => { + let params: string = ''; + + if (command.data.options && command.data.options.length > 1) { + const options = command.data.options as unknown as ApplicationCommandOptionData[]; + + options.map((option: ApplicationCommandOption) => { + params += `**\`${option.name}\`**` + ' '; + }); + } + return `- **\`/${command.data.name}\`** ${params}- ${command.data.description}`; }); diff --git a/src/interactions/components/filters-disable-button.ts b/src/interactions/components/filters-disable-button.ts index 7c1d909..019b266 100644 --- a/src/interactions/components/filters-disable-button.ts +++ b/src/interactions/components/filters-disable-button.ts @@ -56,12 +56,12 @@ const component: BaseComponentInteraction = { new EmbedBuilder() .setAuthor({ name: authorName, - iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl + iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl }) .setDescription( - `**${this.embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.` + `**${embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.` ) - .setColor(this.embedOptions.colors.success) + .setColor(embedOptions.colors.success) ], components: [] }); diff --git a/src/interactions/components/filters-select-menu.ts b/src/interactions/components/filters-select-menu.ts index 211c847..cdac0f6 100644 --- a/src/interactions/components/filters-select-menu.ts +++ b/src/interactions/components/filters-select-menu.ts @@ -103,7 +103,7 @@ const component: BaseComponentInteraction = { }) .join('\n')}` ) - .setColor(this.embedOptions.colors.success) + .setColor(embedOptions.colors.success) ], components: [] }); diff --git a/src/interactions/components/nowplaying-skip-button.ts b/src/interactions/components/nowplaying-skip-button.ts index dd0d62c..8015325 100644 --- a/src/interactions/components/nowplaying-skip-button.ts +++ b/src/interactions/components/nowplaying-skip-button.ts @@ -46,9 +46,9 @@ const component: BaseComponentInteraction = { embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!` + `**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ], components: [] }); @@ -62,9 +62,9 @@ const component: BaseComponentInteraction = { embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.` + `**${embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ], components: [] }); @@ -77,7 +77,7 @@ const component: BaseComponentInteraction = { : `\`${skippedTrack.duration}\``; if (skippedTrack.raw.live) { - durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``; + durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``; } queue.node.skip(); logger.debug('Skipped the track.'); @@ -105,10 +105,10 @@ const component: BaseComponentInteraction = { new EmbedBuilder() .setAuthor({ name: authorName, - iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl + iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl }) .setDescription( - `**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${ + `**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${ skippedTrack.raw.url ?? skippedTrack.url })**` + `${ @@ -122,7 +122,7 @@ const component: BaseComponentInteraction = { }` ) .setThumbnail(skippedTrack.thumbnail) - .setColor(this.embedOptions.colors.success) + .setColor(embedOptions.colors.success) ], components: [] }); diff --git a/src/utils/validation/permissionValidator.ts b/src/utils/validation/permissionValidator.ts index 27f81e6..8cd39a1 100644 --- a/src/utils/validation/permissionValidator.ts +++ b/src/utils/validation/permissionValidator.ts @@ -35,9 +35,9 @@ export const cannotJoinVoiceOrTalk = async ({ interaction, executionId }: Cannot embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nI do not have permission to play audio in the voice channel you are in.\n\nPlease make sure I have the **\`Connect\`** and **\`Speak\`** permissions in this voice channel.` + `**${embedOptions.icons.warning} Oops!**\nI do not have permission to play audio in the voice channel you are in.\n\nPlease make sure I have the **\`Connect\`** and **\`Speak\`** permissions in this voice channel.` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); @@ -84,9 +84,9 @@ export const cannotSendMessageInChannel = async ({ interaction, executionId }: C embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nI do not have permission to send message replies in the channel you are in.\n\nPlease make sure I have the **\`View Channel\`** permission in this text channel.` + `**${embedOptions.icons.warning} Oops!**\nI do not have permission to send message replies in the channel you are in.\n\nPlease make sure I have the **\`View Channel\`** permission in this text channel.` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); } diff --git a/src/utils/validation/queueValidator.ts b/src/utils/validation/queueValidator.ts index 7384eff..dbd037c 100644 --- a/src/utils/validation/queueValidator.ts +++ b/src/utils/validation/queueValidator.ts @@ -25,9 +25,9 @@ export const queueDoesNotExist = async ({ interaction, queue, executionId }: Que embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!` + `**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); @@ -56,9 +56,9 @@ export const queueNoCurrentTrack = async ({ interaction, queue, executionId }: Q embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!` + `**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); @@ -87,9 +87,9 @@ export const queueIsEmpty = async ({ interaction, queue, executionId }: QueueIsE embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nThere are no tracks added to the queue. First add some tracks with **\`/play\`**!` + `**${embedOptions.icons.warning} Oops!**\nThere are no tracks added to the queue. First add some tracks with **\`/play\`**!` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); diff --git a/src/utils/validation/systemCommandValidator.ts b/src/utils/validation/systemCommandValidator.ts index 0513ab3..9e7ac31 100644 --- a/src/utils/validation/systemCommandValidator.ts +++ b/src/utils/validation/systemCommandValidator.ts @@ -26,9 +26,9 @@ export const notValidGuildId = async ({ interaction, executionId }: NotValidGuil embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command **\`/${interactionIdentifier}\`** cannot be executed in this server.` + `**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command **\`/${interactionIdentifier}\`** cannot be executed in this server.` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); diff --git a/src/utils/validation/voiceChannelValidator.ts b/src/utils/validation/voiceChannelValidator.ts index 1102a99..af1211e 100644 --- a/src/utils/validation/voiceChannelValidator.ts +++ b/src/utils/validation/voiceChannelValidator.ts @@ -25,9 +25,9 @@ export const notInVoiceChannel = async ({ interaction, executionId }: NotInVoice embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Not in a voice channel**\nYou need to be in a voice channel to use this command.` + `**${embedOptions.icons.warning} Not in a voice channel**\nYou need to be in a voice channel to use this command.` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] }); @@ -64,9 +64,9 @@ export const notInSameVoiceChannel = async ({ interaction, queue, executionId }: embeds: [ new EmbedBuilder() .setDescription( - `**${this.embedOptions.icons.warning} Not in same voice channel**\nYou need to be in the same voice channel as me to use this command.\n\n**Voice channel:** ${queue.dispatcher.channel.name}` + `**${embedOptions.icons.warning} Not in same voice channel**\nYou need to be in the same voice channel as me to use this command.\n\n**Voice channel:** ${queue.dispatcher.channel.name}` ) - .setColor(this.embedOptions.colors.warning) + .setColor(embedOptions.colors.warning) ] });