From 45606399703703ed83744381ef6172b90c590690 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Fri, 14 Jul 2023 19:13:35 +0200 Subject: [PATCH 01/22] fix: Update description of /skip command --- commands/skip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/skip.js b/commands/skip.js index 9e74ffd..c63a001 100644 --- a/commands/skip.js +++ b/commands/skip.js @@ -6,7 +6,7 @@ const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() .setName('skip') - .setDescription('Skip the current track.') + .setDescription('Skip current or specified track.') .setDMPermission(false) .addNumberOption((option) => option From 923697cce68f9bdc610744768c1213c546cafb00 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Fri, 14 Jul 2023 19:15:30 +0200 Subject: [PATCH 02/22] fix: Update layout and styling for /help command --- commands/help.js | 23 +++++++++++------------ config.json.example | 3 ++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/commands/help.js b/commands/help.js index aef6567..29a6c58 100644 --- a/commands/help.js +++ b/commands/help.js @@ -13,18 +13,17 @@ module.exports = { new EmbedBuilder() .setDescription( `${embedIcons.rule} **List of commands**\n` + - '`/help` - Show this menu.\n' + - '`/play` `query` - Add a track or playlist to the queue by searching or url.\n' + - '`/pause` - Pause or resume the current track.\n' + - '`/queue` `[page]` - Show the list of tracks added to the queue.\n' + - '`/nowplaying` - Show information about the track currently playing.\n' + - '`/filters` - Toggle various audio filters during playback.\n' + - '`/volume` `[percentage]` - Show or set the playback volume for tracks.\n' + - '`/skip` `[trackNumber]` - Skip the current track.\n' + - '`/remove` `trackNumber` - Remove a specific track from the queue.\n' + - '`/leave` - Remove bot from voice channel and clear the queue.\n\n' + - `${embedIcons.support} **Support server**\nJoin the support server for help or suggestions: \n${botInfo.supportServerInviteUrl}\n\n` + - `${embedIcons.bot} **Invite the bot**\nAdd me to another server: \n[Click me!](${botInfo.botInviteUrl})` + '- `/play` `query` - Add a track or playlist to the queue by searching or url.\n' + + '- `/pause` - Pause or resume the current track.\n' + + '- `/queue` `[page]` - Show the list of tracks added to the queue.\n' + + `- \`/nowplaying\` - ${embedIcons.new} Show information about the track currently playing.\n` + + `- \`/filters\` - ${embedIcons.beta} Toggle various audio filters during playback.\n` + + '- `/volume` `[percentage]` - Show or set the playback volume for tracks.\n' + + '- `/skip` `[trackNumber]` - Skip current or specified track.\n' + + '- `/remove` `trackNumber` - Remove a specific track from the queue.\n' + + '- `/leave` - Clear the track queue and remove the bot from voice channel.\n\n' + + `${embedIcons.support} **Support server**\nJoin the support server for help or suggestions: \n**${botInfo.supportServerInviteUrl}**\n\n` + + `${embedIcons.bot} **Enjoying ${botInfo.name}?**\nAdd me to another server: \n**[Click me!](${botInfo.botInviteUrl})**` ) .setColor(embedColors.colorInfo) ] diff --git a/config.json.example b/config.json.example index 76b608b..a17eac6 100644 --- a/config.json.example +++ b/config.json.example @@ -28,7 +28,7 @@ "maxHistorySize": 100 }, "progressBarOptions": { - "length": 12, + "length": 14, "timecodes": false, "separator": "┃", "indicator": "🔘", @@ -37,6 +37,7 @@ }, "embedIcons": { "beta": "`beta`", + "new": "`new`", "rule": "📒", "support": "❓", "bot": "🤖" From 6a44a37c3220f6151b8409b9df6fe5f83fb42539 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Fri, 14 Jul 2023 23:42:44 +0200 Subject: [PATCH 03/22] feat: Added configurable options for icons for use in embeds --- config.json.example | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/config.json.example b/config.json.example index a17eac6..e15dfb6 100644 --- a/config.json.example +++ b/config.json.example @@ -36,11 +36,29 @@ "rightChar": "â–Ŧ" }, "embedIcons": { + "logo": "🤖", "beta": "`beta`", "new": "`new`", "rule": "📒", "support": "❓", - "bot": "🤖" + "bot": "🤖", + "audioPlaying": "✅", + "checkmark": "✅", + "success": "✅", + "error": "âš ī¸", + "warning": "âš ī¸", + "disable": "đŸšĢ", + "enable": "✅", + "nextTrack": "â­ī¸", + "previousTrack": "âŽī¸", + "pauseResumeTrack": "â¯ī¸", + "shuffleQueue": "🔀", + "skipped": "â­ī¸", + "back": "âŽī¸", + "pauseResumed": "â¯ī¸", + "left": "â†Šī¸", + "shuffled": "🔀", + "volume": "🔊" }, "filterThreadAmount": "2", "filterList": [ From f36b4d966822e0618572316223c339c25af2636d Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Fri, 14 Jul 2023 23:54:06 +0200 Subject: [PATCH 04/22] fix: Updated user messages for unexpected errors --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7f50aa7..4d36fc6 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const logger = require('./services/logger.js'); const { EmbedBuilder } = require('discord.js'); const { Player, onBeforeCreateStream } = require('discord-player'); const { stream } = require('yt-stream'); -const { embedColors, botInfo } = require('./config.json'); +const { embedColors, embedIcons, botInfo } = require('./config.json'); require('dotenv').config(); // Setup required permissions for the bot to work @@ -186,7 +186,7 @@ client.on('interactionCreate', async (interaction) => { embeds: [ new EmbedBuilder() .setDescription( - `**Unexpected Error**\nThere was an error while executing this command! Please try again.\n\n_If this issue persists, please submit a bug report in the bot [support server](${botInfo.supportServerInviteUrl})._` + `**${embedIcons.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](${botInfo.supportServerInviteUrl})**._` ) .setColor(embedColors.colorError) ] From 430e66a1a3fe5bb44feb5487bf4699b60c9ec062 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Fri, 14 Jul 2023 23:54:38 +0200 Subject: [PATCH 05/22] fix: Updated user messages for /filter command --- commands/filters.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/commands/filters.js b/commands/filters.js index adad394..6962aba 100644 --- a/commands/filters.js +++ b/commands/filters.js @@ -25,7 +25,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -39,7 +39,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!' + `**${embedIcons.warning} Oops!**\nThere are no tracks in the queue. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -81,13 +81,14 @@ module.exports = { .setCustomId('disable-filters') .setLabel('Disable all filters') .setStyle('Secondary') + .setEmoji(embedIcons.disable) ); const response = await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**Toggle filters** ${embedIcons.beta}\nToggle or disable audio filters for playback.` + `**Toggle filters** ${embedIcons.beta}\nEnable or disable audio filters for playback from the menu.` ) .setColor(embedColors.colorInfo) ], @@ -132,7 +133,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - '**Disabled filters**\nDisabled all audio filters.' + `**${embedIcons.success} Disabled filters**\nAll audio filters have been disabled.` ) .setColor(embedColors.colorSuccess) ], @@ -151,7 +152,9 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Filters enabled**\nThese filters are now enabled:\n${confirmation.values + `**${ + embedIcons.success + } Filters toggled**\nNow using these filters:\n${confirmation.values .map( (enabled) => `\`${ From 0aa810a1d4936da7254c30d101581a37d500ad85 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 00:18:39 +0200 Subject: [PATCH 06/22] fix: Removed icon for leaving. --- config.json.example | 1 - 1 file changed, 1 deletion(-) diff --git a/config.json.example b/config.json.example index e15dfb6..ff31a9b 100644 --- a/config.json.example +++ b/config.json.example @@ -56,7 +56,6 @@ "skipped": "â­ī¸", "back": "âŽī¸", "pauseResumed": "â¯ī¸", - "left": "â†Šī¸", "shuffled": "🔀", "volume": "🔊" }, From 5b214bacb42ffdcd7972dc048f1b5f5dcc90ddb2 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 00:19:17 +0200 Subject: [PATCH 07/22] fix: Updated user messages for /leave command --- commands/leave.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/leave.js b/commands/leave.js index 1f23e79..7b1be20 100644 --- a/commands/leave.js +++ b/commands/leave.js @@ -1,7 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors } = require('../config.json'); +const { embedColors, embedIcons } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -18,7 +18,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -32,7 +32,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nNo tracks are currently playing, and the queue is empty. Use the `/play` command to play some music!' + `**${embedIcons.warning} Oops!**\n_Hmm.._ It seems I am already not in a voice channel!` ) .setColor(embedColors.colorWarning) ] @@ -46,7 +46,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Leaving**\nCleared the track queue and left voice channel. To play more music, use the `/play` command!' + `**${embedIcons.success} Leaving**\nCleared the track queue and left voice channel. To play more music, use the \`/play\` command!` ) .setColor(embedColors.colorSuccess) ] From e64ba0ab3767679006833ec2cc5f5483ae0bb45f Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 00:20:41 +0200 Subject: [PATCH 08/22] fix: Update leaving channel message in /leave --- commands/leave.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/leave.js b/commands/leave.js index 7b1be20..8985577 100644 --- a/commands/leave.js +++ b/commands/leave.js @@ -46,7 +46,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**${embedIcons.success} Leaving**\nCleared the track queue and left voice channel. To play more music, use the \`/play\` command!` + `**${embedIcons.success} Leaving channel**\nCleared the track queue and left voice channel. To play more music, use the \`/play\` command!` ) .setColor(embedColors.colorSuccess) ] From 79b4f075059472b1ec2ff5a5f8d86aa97e89186f Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 00:28:36 +0200 Subject: [PATCH 09/22] fix: Updated user messages for /nowplaying command --- commands/nowplaying.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/commands/nowplaying.js b/commands/nowplaying.js index b2ef645..8ae9d18 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -1,7 +1,11 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js'); -const { embedColors, progressBarOptions } = require('../config.json'); +const { + embedColors, + embedIcons, + progressBarOptions +} = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -14,7 +18,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -28,7 +32,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!' + `**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -40,7 +44,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue or currently playing.' + `**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -56,13 +60,15 @@ module.exports = { ]); const currentTrack = queue.currentTrack; - let author = currentTrack.author ? currentTrack.author : 'Unknown'; + let author = currentTrack.author ? currentTrack.author : 'Unavailable'; if (author === 'cdn.discordapp.com') { - author = 'Unknown'; + author = 'Unavailable'; } - const plays = currentTrack.views !== 0 ? currentTrack.views : 'Unknown'; + const plays = + currentTrack.views !== 0 ? currentTrack.views : 'Unavailable'; const source = - sourceStringsFormatted.get(currentTrack.raw.source) ?? 'Unknown'; + sourceStringsFormatted.get(currentTrack.raw.source) ?? + 'Unavailable'; const queueLength = queue.tracks.data.length; const timestamp = queue.node.getTimestamp(); let bar = `\`${ @@ -88,6 +94,7 @@ module.exports = { .setCustomId('nowplaying-skip') .setLabel('Skip track') .setStyle('Secondary') + .setEmoji(embedIcons.nextTrack) ); const response = await interaction.editReply({ @@ -102,7 +109,7 @@ module.exports = { .setDescription( (queue.node.isPaused() ? '**Currently Paused**\n' - : '**Now Playing**\n') + + : `**${embedIcons.audioPlaying} Now Playing**\n`) + (currentTrack ? `**[${currentTrack.title}](${currentTrack.url})**` : 'None') + @@ -122,7 +129,7 @@ module.exports = { }, { name: '**Audio source**', - value: `[${source}](${currentTrack.url})`, + value: `**[${source}](${currentTrack.url})**`, inline: true } ) @@ -155,7 +162,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue and nothing currently playing.' + `**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ], @@ -192,7 +199,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.` + `**${embedIcons.skipped} Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.` ) .setThumbnail(skippedTrack.thumbnail) .setColor(embedColors.colorSuccess) From 85e1e01b68496d3019ab389fa7ee45bf218b2dae Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 01:09:40 +0200 Subject: [PATCH 10/22] fix: Corrected embed message color on info message in /nowplaying --- commands/nowplaying.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/nowplaying.js b/commands/nowplaying.js index 8ae9d18..594f49e 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -139,7 +139,7 @@ module.exports = { : ' ' }) .setThumbnail(queue.currentTrack.thumbnail) - .setColor(embedColors.colorSuccess) + .setColor(embedColors.colorInfo) ], components: [nowPlayingActionRow] }); From 8f859bb551ab4642bd14297d758e71ccc0c0e5b7 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 01:10:15 +0200 Subject: [PATCH 11/22] fix: Remove unnecessary checkmark icon, added more options. --- config.json.example | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config.json.example b/config.json.example index ff31a9b..e935119 100644 --- a/config.json.example +++ b/config.json.example @@ -42,13 +42,15 @@ "rule": "📒", "support": "❓", "bot": "🤖", - "audioPlaying": "✅", - "checkmark": "✅", + "audioPlaying": "đŸŽļ", + "audioStartedPlaying": "đŸŽļ", "success": "✅", "error": "âš ī¸", "warning": "âš ī¸", "disable": "đŸšĢ", "enable": "✅", + "disabled": "✅", + "enabled": "✅", "nextTrack": "â­ī¸", "previousTrack": "âŽī¸", "pauseResumeTrack": "â¯ī¸", @@ -57,7 +59,9 @@ "back": "âŽī¸", "pauseResumed": "â¯ī¸", "shuffled": "🔀", - "volume": "🔊" + "volume": "🔊", + "volumeChanged": "🔊", + "queue": "đŸŽļ" }, "filterThreadAmount": "2", "filterList": [ From f4aa182fc2718eb68c9a12bce405252e765a2127 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 01:11:41 +0200 Subject: [PATCH 12/22] fix: Updated user messages for /pause command --- commands/pause.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/pause.js b/commands/pause.js index d306427..39cb8bc 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -1,7 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors } = require('../config.json'); +const { embedColors, embedIcons } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -14,7 +14,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -28,7 +28,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!' + `**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -40,7 +40,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue or currently playing.' + `**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -59,7 +59,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Paused**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` + `**${embedIcons.pauseResumed} Paused track**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` ) .setThumbnail(queue.currentTrack.thumbnail) .setColor(embedColors.colorSuccess) @@ -74,7 +74,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Resumed**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` + `**${embedIcons.pauseResumed} Resumed track**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` ) .setThumbnail(queue.currentTrack.thumbnail) .setColor(embedColors.colorSuccess) From c4f14ef6ba6b2bfdf76adc7b9e2ac602ad35716d Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 02:05:23 +0200 Subject: [PATCH 13/22] feat: More error handling in /play command, and overhauled user messages. --- commands/play.js | 115 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 85 insertions(+), 30 deletions(-) diff --git a/commands/play.js b/commands/play.js index 7941988..6e02ab4 100644 --- a/commands/play.js +++ b/commands/play.js @@ -1,7 +1,12 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useMainPlayer, useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors, playerOptions, botInfo } = require('../config.json'); +const { + embedColors, + embedIcons, + playerOptions, + botInfo +} = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -22,7 +27,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -41,7 +46,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**No track found**\nNo results found for \`${query}\`.` + `**${embedIcons.warning} No track found**\nNo results found for \`${query}\`.\n\nIf you specified a URL, please make sure it is valid and public.` ) .setColor(embedColors.colorWarning) ] @@ -57,43 +62,91 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**Unsupported Source**\nThis audio source is a YouTube live stream, which is currently not a supported format.\n\n_If you think that this is incorrect, please submit a bug report in the bot [support server](${botInfo.supportServerInviteUrl})._` + `**${embedIcons.warning} Unsupported audio source**\nYouTube live streams are currently not supported. This is due to issues with extracting audio from the livestream.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._` ) .setColor(embedColors.colorWarning) ] }); } - const { track } = await player.play( - interaction.member.voice.channel, - searchResult, - { - requestedBy: interaction.user, - nodeOptions: { - leaveOnEmpty: playerOptions.leaveOnEmpty ?? true, - leaveOnEmptyCooldown: - playerOptions.leaveOnEmptyCooldown ?? 60000, - leaveOnEnd: playerOptions.leaveOnEnd ?? true, - leaveOnEndCooldown: - playerOptions.leaveOnEndCooldown ?? 60000, - leaveOnStop: playerOptions.leaveOnStop ?? true, - leaveOnStopCooldown: - playerOptions.leaveOnStopCooldown ?? 60000, - maxSize: playerOptions.maxQueueSize ?? 1000, - maxHistorySize: playerOptions.maxHistorySize ?? 100, - volume: playerOptions.defaultVolume ?? 50 - } - } - ); + let track; - const queue = useQueue(interaction.guild.id); + try { + ({ track } = await player.play( + interaction.member.voice.channel, + searchResult, + { + requestedBy: interaction.user, + nodeOptions: { + leaveOnEmpty: playerOptions.leaveOnEmpty ?? true, + leaveOnEmptyCooldown: + playerOptions.leaveOnEmptyCooldown ?? 60000, + leaveOnEnd: playerOptions.leaveOnEnd ?? true, + leaveOnEndCooldown: + playerOptions.leaveOnEndCooldown ?? 60000, + leaveOnStop: playerOptions.leaveOnStop ?? true, + leaveOnStopCooldown: + playerOptions.leaveOnStopCooldown ?? 60000, + maxSize: playerOptions.maxQueueSize ?? 1000, + maxHistorySize: playerOptions.maxHistorySize ?? 100, + volume: playerOptions.defaultVolume ?? 50 + } + } + )); + } catch (error) { + if (error.message.includes('Sign in to confirm your age')) { + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setDescription( + `**${embedIcons.warning} Cannot retrieve audio for track**\nThis audio source is age restricted and requires login to access. Because of this I cannot retrieve the audio for the track.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._` + ) + .setColor(embedColors.colorWarning) + ] + }); + } + + if ( + error.type === 'TypeError' && + (error.message.includes( + 'Cannot read properties of null (reading \'createStream\')' + ) || + error.message.includes( + 'Failed to fetch resources for ytdl streaming' + )) + ) { + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setDescription( + `**${embedIcons.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](${botInfo.supportServerInviteUrl})**._` + ) + .setColor(embedColors.colorError) + ] + }); + } + + if (error.message === 'Cancelled') { + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setDescription( + `**${embedIcons.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](${botInfo.supportServerInviteUrl})**._` + ) + .setColor(embedColors.colorError) + ] + }); + } + } + + let queue = useQueue(interaction.guild.id); if (!queue) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nFailed to add track to queue. Please try again.' + `**${embedIcons.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](${botInfo.supportServerInviteUrl})**._` ) .setColor(embedColors.colorError) ] @@ -119,7 +172,9 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Added playlist to queue**\n${durationFormat} **[${ + `**${ + embedIcons.success + } Added playlist to queue**\n${durationFormat} **[${ track.title }](${track.url})**\n\nAnd **${ searchResult.tracks.length - 1 @@ -140,7 +195,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Started playing**\n${durationFormat} **[${track.title}](${track.url})**` + `**${embedIcons.audioStartedPlaying} Started playing**\n${durationFormat} **[${track.title}](${track.url})**` ) .setThumbnail(track.thumbnail) .setColor(embedColors.colorSuccess) @@ -156,7 +211,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Added to queue**\n${durationFormat} **[${track.title}](${track.url})**` + `${embedIcons.success} **Added to queue**\n${durationFormat} **[${track.title}](${track.url})**` ) .setThumbnail(track.thumbnail) .setColor(embedColors.colorSuccess) From ee11b712a03be55867f738695f02a061c9ce7863 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 02:22:02 +0200 Subject: [PATCH 14/22] fix: Updated user messages for /queue command --- commands/queue.js | 57 +++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/commands/queue.js b/commands/queue.js index 19584f7..5c81d5c 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -1,7 +1,11 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors, progressBarOptions } = require('../config.json'); +const { + embedColors, + embedIcons, + progressBarOptions +} = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -20,19 +24,31 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] }); } + const pageIndex = (interaction.options.getNumber('page') || 1) - 1; const queue = useQueue(interaction.guild.id); let queueString = ''; if (!queue) { - queueString = - 'There are no tracks in the queue. Add tracks with `/play`!'; + if (pageIndex >= 1) { + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setDescription( + `**${embedIcons.warning} Oops!**\nPage \`${pageIndex + 1}\` is not a valid page number.\n\nThe queue is currently empty, first add some tracks with \`/play\`!` + ) + .setColor(embedColors.colorWarning) + ] + }); + } + + queueString = 'The queue is empty, add some tracks with `/play`!'; return await interaction.editReply({ embeds: [ new EmbedBuilder() @@ -40,7 +56,9 @@ module.exports = { name: interaction.guild.name, iconURL: interaction.guild.iconURL() }) - .setDescription(`**Queue**\n${queueString}`) + .setDescription( + `**${embedIcons.queue} Tracks in queue**\n${queueString}` + ) .setColor(embedColors.colorInfo) .setFooter({ text: 'Page 1 of 1' @@ -50,34 +68,33 @@ module.exports = { } const totalPages = Math.ceil(queue.tracks.data.length / 10) || 1; - const page = (interaction.options.getNumber('page') || 1) - 1; - if (page > totalPages - 1) { + if (pageIndex > totalPages - 1) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**Error**\nInvalid page number. There are only a total of \`${totalPages}\` pages of tracks.` + `**${embedIcons.warning} Oops!**\nPage \`${pageIndex + 1}\` is not a valid page number.\n\nThere are only a total of \`${totalPages}\` pages in the queue.` ) - .setColor(embedColors.colorError) + .setColor(embedColors.colorWarning) ] }); } if (queue.tracks.data.length === 0) { - queueString = 'There are no tracks in the queue.'; + queueString = 'The queue is empty, add some tracks with `/play`!'; } else { queueString = queue.tracks.data - .slice(page * 10, page * 10 + 10) + .slice(pageIndex * 10, pageIndex * 10 + 10) .map((track, index) => { let durationFormat = track.raw.duration === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``; - return `**${page * 10 + index + 1}.** ${durationFormat} [${ + return `**${pageIndex * 10 + index + 1}.** ${durationFormat} **[${ track.title - }](${track.url})`; + }](${track.url})**`; }) .join('\n'); } @@ -94,9 +111,11 @@ module.exports = { }kbps)`, iconURL: interaction.guild.iconURL() }) - .setDescription(`**Queue**\n${queueString}`) + .setDescription( + `**${embedIcons.queue} Tracks in queue**\n${queueString}` + ) .setFooter({ - text: `Page ${page + 1} of ${totalPages}` + text: `Page ${pageIndex + 1} of ${totalPages}` }) .setColor(embedColors.colorInfo) ] @@ -118,7 +137,7 @@ module.exports = { currentTrack.raw.duration === 0 || currentTrack.duration === '0:00' ) { - bar = 'No duration available.'; + bar = '_No duration available._'; } return await interaction.editReply({ @@ -131,17 +150,17 @@ module.exports = { iconURL: interaction.guild.iconURL() }) .setDescription( - '**Currently playing**\n' + + `**${embedIcons.audioPlaying} Now playing**\n` + (currentTrack ? `**[${currentTrack.title}](${currentTrack.url})**` : 'None') + `\nRequested by: <@${currentTrack.requestedBy.id}>` + `\n ${bar}` + - `\n\n**Queue**\n${queueString}` + `\n\n**${embedIcons.queue} Tracks in queue**\n${queueString}` ) .setThumbnail(queue.currentTrack.thumbnail) .setFooter({ - text: `Page ${page + 1} of ${totalPages}` + text: `Page ${pageIndex + 1} of ${totalPages}` }) .setColor(embedColors.colorInfo) ] From 0fc9815af150a922eb4379ae23ec95e442ee44c6 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 02:31:55 +0200 Subject: [PATCH 15/22] fix: Updated user messages for /remove --- commands/remove.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/commands/remove.js b/commands/remove.js index d3efe45..ca4cc7f 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -1,7 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors } = require('../config.json'); +const { embedColors, embedIcons } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -10,7 +10,7 @@ module.exports = { .setDMPermission(false) .addNumberOption((option) => option - .setName('tracknumber') + .setName('trackNumber') .setDescription('Track number to remove from queue.') .setMinValue(1) .setRequired(true) @@ -21,7 +21,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -35,29 +35,33 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!' + `**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] }); } - const removeTrackNumber = interaction.options.getNumber('tracknumber'); + const removeTrackNumber = interaction.options.getNumber('trackNumber'); if (removeTrackNumber > queue.tracks.data.length) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**Error**\nThere are \`${queue.tracks.data.length}\` tracks in the queue. You cannot remove track number \`${removeTrackNumber}\`.` + `**${embedIcons.warning} Oops!**\nTrack \`${removeTrackNumber}\` is not a valid track number. There are a total of\`${queue.tracks.data.length}\` tracks in the queue.\n\nView tracks added to the queue with \`/queue\`.` ) - .setColor(embedColors.colorError) + .setColor(embedColors.colorWarning) ] }); } // Remove specified track number from queue const removedTrack = queue.node.remove(removeTrackNumber - 1); + let durationFormat = + removedTrack.raw.duration === 0 || removedTrack.duration === '0:00' + ? '' + : `\`${removedTrack.duration}\``; return await interaction.editReply({ embeds: [ @@ -67,7 +71,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Removed**\n**[${removedTrack.title}](${removedTrack.url})**.` + `**${embedIcons.success} Removed track**\n${durationFormat} **[${removedTrack.title}](${removedTrack.url})**.` ) .setThumbnail(removedTrack.thumbnail) .setColor(embedColors.colorSuccess) From bf69d943540adc424288a247b8a72ecae1dce881 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 02:40:54 +0200 Subject: [PATCH 16/22] fix: Fixed invalid command option name (must be all lowercase) --- commands/remove.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/remove.js b/commands/remove.js index ca4cc7f..8303e34 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -10,7 +10,7 @@ module.exports = { .setDMPermission(false) .addNumberOption((option) => option - .setName('trackNumber') + .setName('tracknumber') .setDescription('Track number to remove from queue.') .setMinValue(1) .setRequired(true) @@ -42,7 +42,7 @@ module.exports = { }); } - const removeTrackNumber = interaction.options.getNumber('trackNumber'); + const removeTrackNumber = interaction.options.getNumber('tracknumber'); if (removeTrackNumber > queue.tracks.data.length) { return await interaction.editReply({ From 960d55359546ef593bad9f2a0b7384c757346410 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 02:43:01 +0200 Subject: [PATCH 17/22] fix: Updated user messages for /skip command --- commands/skip.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/commands/skip.js b/commands/skip.js index c63a001..30d5fae 100644 --- a/commands/skip.js +++ b/commands/skip.js @@ -1,7 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors } = require('../config.json'); +const { embedColors, embedIcons } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -20,7 +20,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -34,7 +34,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!' + `**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -49,9 +49,9 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**Error**\nThere are \`${queue.tracks.data.length}\` tracks in the queue. You cannot skip to track number \`${skipToTrack}\`.` + `**${embedIcons.warning} Oops!**\nThere are only \`${queue.tracks.data.length}\` tracks in the queue. You cannot skip to track \`${skipToTrack}\`.\n\nView tracks added to the queue with \`/queue\`.` ) - .setColor(embedColors.colorError) + .setColor(embedColors.colorWarning) ] }); } else { @@ -71,7 +71,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.` + `**${embedIcons.skipped} Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.` ) .setThumbnail(skippedTrack.thumbnail) .setColor(embedColors.colorSuccess) @@ -84,7 +84,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks in the queue and nothing currently playing.' + `**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -107,7 +107,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.` + `**${embedIcons.skipped} Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.` ) .setThumbnail(skippedTrack.thumbnail) .setColor(embedColors.colorSuccess) From 5054da995a428740bfda211ef836315c410c86cc Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 02:56:10 +0200 Subject: [PATCH 18/22] fix: Updated user messages for /volume command --- commands/volume.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/commands/volume.js b/commands/volume.js index ad70f95..dfea041 100644 --- a/commands/volume.js +++ b/commands/volume.js @@ -1,7 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors } = require('../config.json'); +const { embedColors, embedIcons } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -12,7 +12,7 @@ module.exports = { option .setName('percentage') .setDescription('Set volume percentage from 1% to 100%.') - .setMinValue(1) + .setMinValue(0) .setMaxValue(100) ), run: async ({ interaction }) => { @@ -21,7 +21,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nYou need to be in a voice channel to use this command.' + `**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.` ) .setColor(embedColors.colorWarning) ] @@ -35,7 +35,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed**\nThere are no tracks playing or in the queue. Add tracks with `/play`!' + `**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with \`/play\`!` ) .setColor(embedColors.colorWarning) ] @@ -44,29 +44,45 @@ module.exports = { const volume = interaction.options.getNumber('percentage'); - if (!volume) { + if (!volume && volume !== 0) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - `**Volume**\nThe playback volume is currently set at \`${queue.node.volume}%\`.` + `**${embedIcons.volume} Playback volume**\nThe playback volume is currently set to \`${queue.node.volume}%\`.` ) .setColor(embedColors.colorInfo) ] }); - } else if (volume > 100 || volume < 1) { + } else if (volume > 100 || volume < 0) { return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription( - '**Error**\nYou need to pick a number between `1` and `100`.' + `**${embedIcons.warning} Oops!**\nYou cannot set the volume to \`${volume}\`, please pick a value betwen \`1\`% and \`100\`%.` ) - .setColor(embedColors.colorError) + .setColor(embedColors.colorWarning) ] }); } else { queue.node.setVolume(volume); + if (volume === 0) { + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setAuthor({ + name: interaction.user.username, + iconURL: interaction.user.avatarURL() + }) + .setDescription( + `**${embedIcons.volumeChanged} Audio muted**\nPlayback audio has been muted, because volume was set to \`${volume}%\`.` + ) + .setColor(embedColors.colorSuccess) + ] + }); + } + return await interaction.editReply({ embeds: [ new EmbedBuilder() @@ -75,7 +91,7 @@ module.exports = { iconURL: interaction.user.avatarURL() }) .setDescription( - `**Volume changed**\nPlayback volume has been set to \`${volume}%\`.` + `**${embedIcons.volumeChanged} Volume changed**\nPlayback volume has been changed to \`${volume}%\`.` ) .setColor(embedColors.colorSuccess) ] From 15f1a876e816b438b00defc2cf0113cf32a523ff Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 03:08:34 +0200 Subject: [PATCH 19/22] fix: Updated user message in status commands --- system-commands/guilds.js | 21 +++++++++++++++------ system-commands/status.js | 12 ++++++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/system-commands/guilds.js b/system-commands/guilds.js index 97ffc22..77ea5a5 100644 --- a/system-commands/guilds.js +++ b/system-commands/guilds.js @@ -1,6 +1,10 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { EmbedBuilder } = require('discord.js'); -const { embedColors, systemServerGuildIds } = require('../config.json'); +const { + embedColors, + embedIcons, + systemServerGuildIds +} = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -13,9 +17,9 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**No permission**\nThe command \`${interaction.commandName}\` cannot be executed in this server.` + `**${embedIcons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.` ) - .setColor(embedColors.colorError) + .setColor(embedColors.colorWarning) ] }); } @@ -27,11 +31,16 @@ module.exports = { memberCount: guild.memberCount }; }) + .slice(0, 50) .sort((a, b) => b.memberCount - a.memberCount) - .map((guild) => `\`${guild.name} (#${guild.memberCount})\``) - .join(', '); + .map((guild, index) => `${index + 1}. \`${guild.name} (#${guild.memberCount})\``) + .join('\n'); - let embedDescription = `**Guilds (${client.guilds.cache.size} total)**\n${guildsList}`; + let embedDescription = `**${embedIcons.bot} ${ + client.guilds.cache.size < 50 + ? 'Guilds' + : `Top ${client.guilds.cache.size} guilds` + } by member count (${client.guilds.cache.size} total)**\n${guildsList}`; if (embedDescription.length >= 4000) { embedDescription = `${embedDescription.slice(0, 3996)}...`; diff --git a/system-commands/status.js b/system-commands/status.js index c5ba1b9..4a0f742 100644 --- a/system-commands/status.js +++ b/system-commands/status.js @@ -1,7 +1,11 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { EmbedBuilder } = require('discord.js'); const { useQueue } = require('discord-player'); -const { embedColors, systemServerGuildIds } = require('../config.json'); +const { + embedColors, + embedIcons, + systemServerGuildIds +} = require('../config.json'); const osu = require('node-os-utils'); const packageJson = require('../package.json'); @@ -16,9 +20,9 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**No permission**\nThe command \`${interaction.commandName}\` cannot be executed in this server.` + `**${embedIcons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.` ) - .setColor(embedColors.colorError) + .setColor(embedColors.colorWarning) ] }); } @@ -56,7 +60,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**System and bot status**\n' + + `**${embedIcons.bot} System and bot status**\n` + `Uptime: \`${uptimeString}\`\n` + `Platform: \`${platform}\`\n` + `CPU cores: \`${cpuCores}\`\n` + From dc3118de153ac261192958783f4ba71da6253170 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 03:08:49 +0200 Subject: [PATCH 20/22] Removed comments --- index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/index.js b/index.js index 4d36fc6..c200ad0 100644 --- a/index.js +++ b/index.js @@ -154,9 +154,6 @@ client.on('interactionCreate', async (interaction) => { `(${interaction.guild.memberCount}) ${interaction.guild.name}> Command '${interaction}' took ${executionTime} ms to execute.` ); - // todo: using interaction.editReply() might lead to "unknown interaction" error - // it might already have been replied to or deferred - // solution might be to use interaction.followUp() instead or send a message to the channel? return await interaction.followUp({ embeds: [ new EmbedBuilder() @@ -179,9 +176,6 @@ client.on('interactionCreate', async (interaction) => { `(${interaction.guild.memberCount}) ${interaction.guild.name}> Command '${interaction}' failed to execute.` ); - // todo: using interaction.editReply() might lead to "unknown interaction" error - // it might already have been replied to or deferred - // solution might be to use interaction.followUp() instead or send a message to the channel? await interaction.followUp({ embeds: [ new EmbedBuilder() From 3b496ad4a8f002024829efd3d3ce3ef368b35d52 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 03:09:08 +0200 Subject: [PATCH 21/22] fix: Add await in interaction reply when toggling filters --- commands/filters.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/filters.js b/commands/filters.js index 6962aba..0ffbc2e 100644 --- a/commands/filters.js +++ b/commands/filters.js @@ -125,7 +125,7 @@ module.exports = { confirmation.customId === 'disable-filters' || confirmation.values.length === 0 ) { - return interaction.editReply({ + return await interaction.editReply({ embeds: [ new EmbedBuilder() .setAuthor({ From d720eeccfc723ba83538b739d66e8e91bf8984c6 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 03:09:34 +0200 Subject: [PATCH 22/22] fix: Add warning embed icon to /nowplaying that was missing --- commands/nowplaying.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/nowplaying.js b/commands/nowplaying.js index 594f49e..fbbc4ff 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -175,7 +175,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - '**Failed to skip**\nThis track has already been skipped, or is no longer playing.' + '**${embedIcons.warning} Oops!**\nThis track has already been skipped or is no longer playing.' ) .setColor(embedColors.colorWarning) ],