From 79b4f075059472b1ec2ff5a5f8d86aa97e89186f Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 00:28:36 +0200 Subject: [PATCH] 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)