From 62505664381bf5290a2b45f305e62f096d4e7862 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 16 Dec 2023 22:40:15 +0100 Subject: [PATCH 1/6] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fc25720..2aa9547 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,12 @@ ## Core Features 🌟 Cadence offers an enriching audio experience on Discord with features such as: -- High-quality music playback from [many supported sources](https://discord-player.js.org/guide/extractors/stream-sources) thanks to [discord-player](https://github.com/androz2091/discord-player) -- Implements latest Discord features such as slash commands, autocompleting search queries and more -- Open-source codebase and community based development, open to feedback and improvements -- No locked functionality, no premium tier, no ads; everything's free, always +- High-quality music playback from [many supported sources](https://discord-player.js.org/guide/extractors/stream-sources) thanks to [discord-player](https://github.com/androz2091/discord-player). +- Implements latest Discord features such as slash commands, autocompleting search queries, select menus, buttons and more! +- Full queue management system to add, remove, skip or move tracks, view queue and history. +- Audio filters, shuffle mode, repeat track, queue or autoplay similar tracks! +- Open-source codebase and community based development, open to feedback and improvements. +- No locked functionality, no premium tier, no ads; everything's free, always.
From c8d8d3c8f9f5eea3ccc74d099aaf234668b56708 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 16 Dec 2023 22:40:57 +0100 Subject: [PATCH 2/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2aa9547..a288fde 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ ## Core Features 🌟 Cadence offers an enriching audio experience on Discord with features such as: - High-quality music playback from [many supported sources](https://discord-player.js.org/guide/extractors/stream-sources) thanks to [discord-player](https://github.com/androz2091/discord-player). -- Implements latest Discord features such as slash commands, autocompleting search queries, select menus, buttons and more! +- Latest Discord features such as slash commands, autocompleting search queries, select menus, buttons and more! - Full queue management system to add, remove, skip or move tracks, view queue and history. - Audio filters, shuffle mode, repeat track, queue or autoplay similar tracks! - Open-source codebase and community based development, open to feedback and improvements. From 47da84cd0004420008cbc55093fb7e43488f9802 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 16 Dec 2023 22:41:21 +0100 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a288fde..8c7ba8e 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ ## Core Features 🌟 Cadence offers an enriching audio experience on Discord with features such as: - High-quality music playback from [many supported sources](https://discord-player.js.org/guide/extractors/stream-sources) thanks to [discord-player](https://github.com/androz2091/discord-player). -- Latest Discord features such as slash commands, autocompleting search queries, select menus, buttons and more! +- Discord features such as slash commands, autocompleting search queries, select menus, buttons and more! - Full queue management system to add, remove, skip or move tracks, view queue and history. - Audio filters, shuffle mode, repeat track, queue or autoplay similar tracks! - Open-source codebase and community based development, open to feedback and improvements. From bc83216c45c8be37ab86c9022075154f331ac99a Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 16 Dec 2023 22:42:11 +0100 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c7ba8e..407df9d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ ## Core Features 🌟 Cadence offers an enriching audio experience on Discord with features such as: - High-quality music playback from [many supported sources](https://discord-player.js.org/guide/extractors/stream-sources) thanks to [discord-player](https://github.com/androz2091/discord-player). -- Discord features such as slash commands, autocompleting search queries, select menus, buttons and more! +- Slash commands, autocompleting search queries, select menus, buttons and more interactive features! - Full queue management system to add, remove, skip or move tracks, view queue and history. - Audio filters, shuffle mode, repeat track, queue or autoplay similar tracks! - Open-source codebase and community based development, open to feedback and improvements. From 612e3a00a65fc8c3aa36b5c0c0a012349d44ee09 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 16 Dec 2023 22:55:24 +0100 Subject: [PATCH 5/6] fix: Replace support server and add bot info with link buttons in /help --- src/interactions/commands/info/help.ts | 79 +++++++++++++------------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/src/interactions/commands/info/help.ts b/src/interactions/commands/info/help.ts index 8e4c521..54810a0 100644 --- a/src/interactions/commands/info/help.ts +++ b/src/interactions/commands/info/help.ts @@ -1,5 +1,11 @@ import { + APIActionRowComponent, + APIButtonComponent, + APIMessageActionRowComponent, + ButtonBuilder, + ButtonStyle, Collection, + ComponentType, EmbedBuilder, SlashCommandBuilder, SlashCommandNumberOption, @@ -19,24 +25,43 @@ class HelpCommand extends BaseSlashCommandInteraction { const { executionId, client, interaction } = params; const logger = this.getLogger(this.name, executionId, interaction); - const [commandEmbedString, supportServerString, addBotString] = await Promise.all([ - this.getCommandEmbedString(client!), - this.getSupportServerString(), - this.getAddBotString() - ]); + const commandEmbedString = await this.getCommandEmbedString(client!); + + const components: APIMessageActionRowComponent[] = []; + + if (this.botOptions.serverInviteUrl && this.botOptions.serverInviteUrl !== '') { + const supportServerButton: APIButtonComponent = new ButtonBuilder() + .setURL(this.botOptions.serverInviteUrl) + .setStyle(ButtonStyle.Link) + .setEmoji(this.embedOptions.icons.support) + .setLabel('Support server') + .toJSON(); + components.push(supportServerButton); + } + + if (this.botOptions.botInviteUrl && this.botOptions.botInviteUrl !== '') { + const addBotButton: APIButtonComponent = new ButtonBuilder() + .setURL(this.botOptions.botInviteUrl) + .setStyle(ButtonStyle.Link) + .setEmoji(this.embedOptions.icons.bot) + .setLabel('Add bot') + .toJSON(); + components.push(addBotButton); + } + + const embedActionRow: APIActionRowComponent = { + type: ComponentType.ActionRow, + components + }; logger.debug('Responding with info embed.'); return await interaction.editReply({ embeds: [ new EmbedBuilder() - .setDescription( - `${this.embedOptions.icons.rule} **List of commands**\n` + - commandEmbedString + - supportServerString + - addBotString - ) + .setDescription(`${this.embedOptions.icons.rule} **List of commands**\n` + commandEmbedString) .setColor(this.embedOptions.colors.info) - ] + ], + components: [embedActionRow] }); } @@ -58,7 +83,7 @@ class HelpCommand extends BaseSlashCommandInteraction { return this.getCommandString(command); }); - const commandString = commandStringList.join('\n') + '\n'; + const commandString = commandStringList.join('\n'); return commandString; } @@ -76,34 +101,6 @@ class HelpCommand extends BaseSlashCommandInteraction { } return ''; } - - private async getSupportServerString(): Promise { - if (!this.botOptions.serverInviteUrl) { - return ''; - } - - const embedString = ` - ${this.embedOptions.icons.support} **Support server** - Join the support server for help or to suggest improvements: - **${this.botOptions.serverInviteUrl}** - `; - - return embedString; - } - - private async getAddBotString(): Promise { - if (!this.botOptions.botInviteUrl) { - return ''; - } - - const embedString = ` - ${this.embedOptions.icons.bot} **Enjoying ${this.botOptions.name}?** - Add me to another server: - **[Click me!](${this.botOptions.botInviteUrl})** - `; - - return embedString; - } } export default new HelpCommand(); From a39e3597597e7fc189aef078138ea40641787729 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 16 Dec 2023 22:57:53 +0100 Subject: [PATCH 6/6] fix /help buttons if undefined links in config --- src/interactions/commands/info/help.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interactions/commands/info/help.ts b/src/interactions/commands/info/help.ts index 54810a0..7260e16 100644 --- a/src/interactions/commands/info/help.ts +++ b/src/interactions/commands/info/help.ts @@ -61,7 +61,7 @@ class HelpCommand extends BaseSlashCommandInteraction { .setDescription(`${this.embedOptions.icons.rule} **List of commands**\n` + commandEmbedString) .setColor(this.embedOptions.colors.info) ], - components: [embedActionRow] + components: components.length > 0 ? [embedActionRow] : [] }); }