mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 22:16:13 +00:00
fix: reply with "started playing" when adding track to empty queue
This commit is contained in:
1 parent
504bdeb686
commit
4885398f05
1 file changed
+32
-1
+32
-1
@@ -1,5 +1,5 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useMainPlayer } = require('discord-player');
|
||||
const { useMainPlayer, useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
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') {
|
||||
track.thumbnail =
|
||||
'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({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
|
||||
Reference in new issue
Block a user