mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 06:28:53 +00:00
fix: Handle max queue size in /play command when adding large playlists.
This commit is contained in:
1 parent
d9d66449d1
commit
8e42f755e7
3 files changed
+25
-2
No files matched your search
@@ -102,6 +102,23 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
|
||||
let queue = useQueue(interaction.guild.id);
|
||||
let queueSize = queue?.size ?? 0;
|
||||
|
||||
if ((searchResult.playlist && searchResult.tracks.length) > playerOptions.maxQueueSize - queueSize) {
|
||||
logger.debug(`[Shard ${interaction.guild.shardId}] Playlist found but too many tracks. Query: ${query}.`);
|
||||
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.warning} Playlist too large**\nThis playlist is too large to be added to the queue.\n\nThe maximum amount of tracks that can be added to the queue is **${playerOptions.maxQueueSize}**.`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
let track;
|
||||
|
||||
try {
|
||||
@@ -202,7 +219,7 @@ module.exports = {
|
||||
);
|
||||
}
|
||||
|
||||
let queue = useQueue(interaction.guild.id);
|
||||
queue = useQueue(interaction.guild.id);
|
||||
|
||||
if (!queue) {
|
||||
logger.warn(
|
||||
|
||||
Reference in new issue
Block a user