mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 06:28:53 +00:00
fix: Updated user messages for /nowplaying command
This commit is contained in:
1 parent
e64ba0ab37
commit
79b4f07505
1 file changed
+19
-12
+19
-12
@@ -1,7 +1,11 @@
|
|||||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||||
const { useQueue } = require('discord-player');
|
const { useQueue } = require('discord-player');
|
||||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
|
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
|
||||||
const { embedColors, progressBarOptions } = require('../config.json');
|
const {
|
||||||
|
embedColors,
|
||||||
|
embedIcons,
|
||||||
|
progressBarOptions
|
||||||
|
} = require('../config.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -14,7 +18,7 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.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)
|
.setColor(embedColors.colorWarning)
|
||||||
]
|
]
|
||||||
@@ -28,7 +32,7 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.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)
|
.setColor(embedColors.colorWarning)
|
||||||
]
|
]
|
||||||
@@ -40,7 +44,7 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.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)
|
.setColor(embedColors.colorWarning)
|
||||||
]
|
]
|
||||||
@@ -56,13 +60,15 @@ module.exports = {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const currentTrack = queue.currentTrack;
|
const currentTrack = queue.currentTrack;
|
||||||
let author = currentTrack.author ? currentTrack.author : 'Unknown';
|
let author = currentTrack.author ? currentTrack.author : 'Unavailable';
|
||||||
if (author === 'cdn.discordapp.com') {
|
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 =
|
const source =
|
||||||
sourceStringsFormatted.get(currentTrack.raw.source) ?? 'Unknown';
|
sourceStringsFormatted.get(currentTrack.raw.source) ??
|
||||||
|
'Unavailable';
|
||||||
const queueLength = queue.tracks.data.length;
|
const queueLength = queue.tracks.data.length;
|
||||||
const timestamp = queue.node.getTimestamp();
|
const timestamp = queue.node.getTimestamp();
|
||||||
let bar = `\`${
|
let bar = `\`${
|
||||||
@@ -88,6 +94,7 @@ module.exports = {
|
|||||||
.setCustomId('nowplaying-skip')
|
.setCustomId('nowplaying-skip')
|
||||||
.setLabel('Skip track')
|
.setLabel('Skip track')
|
||||||
.setStyle('Secondary')
|
.setStyle('Secondary')
|
||||||
|
.setEmoji(embedIcons.nextTrack)
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await interaction.editReply({
|
const response = await interaction.editReply({
|
||||||
@@ -102,7 +109,7 @@ module.exports = {
|
|||||||
.setDescription(
|
.setDescription(
|
||||||
(queue.node.isPaused()
|
(queue.node.isPaused()
|
||||||
? '**Currently Paused**\n'
|
? '**Currently Paused**\n'
|
||||||
: '**Now Playing**\n') +
|
: `**${embedIcons.audioPlaying} Now Playing**\n`) +
|
||||||
(currentTrack
|
(currentTrack
|
||||||
? `**[${currentTrack.title}](${currentTrack.url})**`
|
? `**[${currentTrack.title}](${currentTrack.url})**`
|
||||||
: 'None') +
|
: 'None') +
|
||||||
@@ -122,7 +129,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '**Audio source**',
|
name: '**Audio source**',
|
||||||
value: `[${source}](${currentTrack.url})`,
|
value: `**[${source}](${currentTrack.url})**`,
|
||||||
inline: true
|
inline: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -155,7 +162,7 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.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)
|
.setColor(embedColors.colorWarning)
|
||||||
],
|
],
|
||||||
@@ -192,7 +199,7 @@ module.exports = {
|
|||||||
iconURL: interaction.user.avatarURL()
|
iconURL: interaction.user.avatarURL()
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.`
|
`**${embedIcons.skipped} Skipped track**\n${durationFormat} **[${skippedTrack.title}](${skippedTrack.url})**.`
|
||||||
)
|
)
|
||||||
.setThumbnail(skippedTrack.thumbnail)
|
.setThumbnail(skippedTrack.thumbnail)
|
||||||
.setColor(embedColors.colorSuccess)
|
.setColor(embedColors.colorSuccess)
|
||||||
|
|||||||
Reference in new issue
Block a user