mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
Updated interaction reply to have embed with color
This commit is contained in:
1 parent
7437f67cbe
commit
4a7bf9ecb9
4 files changed
+86
-23
No files matched your search
+18
-6
@@ -8,17 +8,27 @@ module.exports = {
|
|||||||
.setDescription('Pause the currently playing track.'),
|
.setDescription('Pause the currently playing track.'),
|
||||||
run: async ({ interaction }) => {
|
run: async ({ interaction }) => {
|
||||||
if (!interaction.member.voice.channel) {
|
if (!interaction.member.voice.channel) {
|
||||||
return interaction.editReply(
|
return interaction.editReply({
|
||||||
'You need to be in a voice channel to use this command.'
|
embeds: [
|
||||||
);
|
new EmbedBuilder()
|
||||||
|
.setDescription(
|
||||||
|
`You need to be in a voice channel to use this command.`
|
||||||
|
)
|
||||||
|
.setColor('#c70057')
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const queue = useQueue(interaction.guild.id);
|
const queue = useQueue(interaction.guild.id);
|
||||||
|
|
||||||
if (!queue) {
|
if (!queue) {
|
||||||
return await interaction.editReply(
|
return await interaction.editReply({
|
||||||
'There are no tracks in the queue.'
|
embeds: [
|
||||||
);
|
new EmbedBuilder()
|
||||||
|
.setDescription(`There are no tracks in the queue.`)
|
||||||
|
.setColor('#c70057')
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// change paused state to opposite of current state
|
// change paused state to opposite of current state
|
||||||
@@ -35,6 +45,7 @@ module.exports = {
|
|||||||
`**Paused**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.`
|
`**Paused**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.`
|
||||||
)
|
)
|
||||||
.setThumbnail(queue.currentTrack.thumbnail)
|
.setThumbnail(queue.currentTrack.thumbnail)
|
||||||
|
.setColor('#4c73df')
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -49,6 +60,7 @@ module.exports = {
|
|||||||
`**Resumed**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.`
|
`**Resumed**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.`
|
||||||
)
|
)
|
||||||
.setThumbnail(queue.currentTrack.thumbnail)
|
.setThumbnail(queue.currentTrack.thumbnail)
|
||||||
|
.setColor('#4c73df')
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-3
@@ -14,9 +14,15 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
run: async ({ interaction }) => {
|
run: async ({ interaction }) => {
|
||||||
if (!interaction.member.voice.channel) {
|
if (!interaction.member.voice.channel) {
|
||||||
return interaction.editReply(
|
return interaction.editReply({
|
||||||
'You need to be in a voice channel to use this command.'
|
embeds: [
|
||||||
);
|
new EmbedBuilder()
|
||||||
|
.setDescription(
|
||||||
|
`You need to be in a voice channel to use this command.`
|
||||||
|
)
|
||||||
|
.setColor('#c70057')
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const player = useMainPlayer();
|
const player = useMainPlayer();
|
||||||
@@ -48,6 +54,7 @@ module.exports = {
|
|||||||
`**Added to queue**\n\`[${track.duration}]\` **[${track.title}](${track.url})**`
|
`**Added to queue**\n\`[${track.duration}]\` **[${track.title}](${track.url})**`
|
||||||
)
|
)
|
||||||
.setThumbnail(track.thumbnail)
|
.setThumbnail(track.thumbnail)
|
||||||
|
.setColor('#4c73df')
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
+49
-11
@@ -1,5 +1,5 @@
|
|||||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||||
const { useMainPlayer, useQueue } = require('discord-player');
|
const { useQueue } = require('discord-player');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -14,30 +14,50 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
run: async ({ interaction }) => {
|
run: async ({ interaction }) => {
|
||||||
if (!interaction.member.voice.channel) {
|
if (!interaction.member.voice.channel) {
|
||||||
return interaction.editReply(
|
return interaction.editReply({
|
||||||
'You need to be in a voice channel to use this command.'
|
embeds: [
|
||||||
);
|
new EmbedBuilder()
|
||||||
|
.setDescription(
|
||||||
|
`You need to be in a voice channel to use this command.`
|
||||||
|
)
|
||||||
|
.setColor('#c70057')
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const queue = useQueue(interaction.guild.id);
|
const queue = useQueue(interaction.guild.id);
|
||||||
|
let queueString = '';
|
||||||
|
|
||||||
if (!queue) {
|
if (!queue) {
|
||||||
return await interaction.editReply(
|
queueString = 'There are no tracks in the queue.';
|
||||||
'There are no tracks in the queue.'
|
return await interaction.editReply({
|
||||||
);
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.guild.name,
|
||||||
|
iconURL: interaction.guild.iconURL()
|
||||||
|
})
|
||||||
|
.setDescription(`**Queue**\n${queueString}`)
|
||||||
|
.setColor('#4c73df')
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalPages = Math.ceil(queue.tracks.data.length / 10) || 1;
|
const totalPages = Math.ceil(queue.tracks.data.length / 10) || 1;
|
||||||
const page = (interaction.options.getNumber('page') || 1) - 1;
|
const page = (interaction.options.getNumber('page') || 1) - 1;
|
||||||
|
|
||||||
if (page > totalPages - 1) {
|
if (page > totalPages - 1) {
|
||||||
return await interaction.editReply(
|
return await interaction.editReply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setDescription(
|
||||||
`Invalid page number. There are only a total of ${totalPages} pages of tracks.`
|
`Invalid page number. There are only a total of ${totalPages} pages of tracks.`
|
||||||
);
|
)
|
||||||
|
.setColor('#c70057')
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let queueString = '';
|
|
||||||
|
|
||||||
if (queue.tracks.data.length === 0) {
|
if (queue.tracks.data.length === 0) {
|
||||||
queueString = 'There are no tracks in the queue.';
|
queueString = 'There are no tracks in the queue.';
|
||||||
} else {
|
} else {
|
||||||
@@ -53,6 +73,22 @@ module.exports = {
|
|||||||
|
|
||||||
let currentTrack = queue.currentTrack;
|
let currentTrack = queue.currentTrack;
|
||||||
|
|
||||||
|
if (!currentTrack) {
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.guild.name,
|
||||||
|
iconURL: interaction.guild.iconURL()
|
||||||
|
})
|
||||||
|
.setDescription(`**Queue**\n${queueString}`)
|
||||||
|
.setFooter({
|
||||||
|
text: `Page ${page + 1} of ${totalPages}`
|
||||||
|
})
|
||||||
|
.setColor('#4c73df')
|
||||||
|
]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
let bar = queue.node.createProgressBar({
|
let bar = queue.node.createProgressBar({
|
||||||
queue: false,
|
queue: false,
|
||||||
length: 13
|
length: 13
|
||||||
@@ -78,7 +114,9 @@ module.exports = {
|
|||||||
.setFooter({
|
.setFooter({
|
||||||
text: `Page ${page + 1} of ${totalPages}`
|
text: `Page ${page + 1} of ${totalPages}`
|
||||||
})
|
})
|
||||||
|
.setColor('#4c73df')
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -76,9 +76,15 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
`Command '/${interaction.commandName}' failed unexpectedly.`
|
`Command '/${interaction.commandName}' failed unexpectedly.`
|
||||||
);
|
);
|
||||||
|
|
||||||
await interaction.editReply(
|
await interaction.editReply({
|
||||||
'There was an error while executing this command!'
|
embeds: [
|
||||||
);
|
new EmbedBuilder()
|
||||||
|
.setDescription(
|
||||||
|
`There was an error while executing this command!`
|
||||||
|
)
|
||||||
|
.setColor('#c70057')
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user