mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
Merge pull request #28 from mariusbegby/update-message-in-play-command-on-empty-queue
fix: reply with "started playing" when adding track to empty queue
This commit is contained in:
1 file changed
+32
-1
+32
-1
@@ -1,5 +1,5 @@
|
|||||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||||
const { useMainPlayer } = require('discord-player');
|
const { useMainPlayer, useQueue } = require('discord-player');
|
||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
const { embedColors, playerOptions } = require('../config.json');
|
const { embedColors, playerOptions } = require('../config.json');
|
||||||
|
|
||||||
@@ -83,6 +83,20 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const 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.`
|
||||||
|
)
|
||||||
|
.setColor(embedColors.colorError)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (track.source === 'arbitrary') {
|
if (track.source === 'arbitrary') {
|
||||||
track.thumbnail =
|
track.thumbnail =
|
||||||
'https://raw.githubusercontent.com/mariusbegby/cadence-discord-bot/main/icons/Cadence-icon-rounded-128px.png';
|
'https://raw.githubusercontent.com/mariusbegby/cadence-discord-bot/main/icons/Cadence-icon-rounded-128px.png';
|
||||||
@@ -114,6 +128,23 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (queue.currentTrack === track) {
|
||||||
|
return await interaction.editReply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.user.username,
|
||||||
|
iconURL: interaction.user.avatarURL()
|
||||||
|
})
|
||||||
|
.setDescription(
|
||||||
|
`**Started playing**\n${durationFormat} **[${track.title}](${track.url})**`
|
||||||
|
)
|
||||||
|
.setThumbnail(track.thumbnail)
|
||||||
|
.setColor(embedColors.colorSuccess)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
|
|||||||
Reference in new issue
Block a user