mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
3 files changed
+72
-1
No files matched your search
@@ -14,7 +14,7 @@ const { useQueue } = require('discord-player');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: true,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('filters')
|
.setName('filters')
|
||||||
.setDescription('Toggle various audio filters during playback.')
|
.setDescription('Toggle various audio filters during playback.')
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
const logger = require('../../services/logger');
|
||||||
|
const { embedOptions } = require('../../config');
|
||||||
|
const { notInVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||||
|
const { queueDoesNotExist, queueIsEmpty } = require('../../utils/validation/queueValidator');
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
|
const { useQueue } = require('discord-player');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
isNew: true,
|
||||||
|
isBeta: false,
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('shuffle')
|
||||||
|
.setDescription('Shuffle tracks in the queue randomly.')
|
||||||
|
.setDMPermission(false)
|
||||||
|
.setNSFW(false),
|
||||||
|
execute: async ({ interaction }) => {
|
||||||
|
if (await notInVoiceChannel(interaction)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const queue = useQueue(interaction.guild.id);
|
||||||
|
|
||||||
|
if (await queueDoesNotExist(interaction, queue)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await queueIsEmpty(interaction, queue)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
queue.tracks.shuffle();
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
`[Shard ${interaction.guild.shardId}] User used command ${interaction.commandName} and shuffled the queue.`
|
||||||
|
);
|
||||||
|
|
||||||
|
return await interaction.editReply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.member.nickname || interaction.user.username,
|
||||||
|
iconURL: interaction.user.avatarURL()
|
||||||
|
})
|
||||||
|
.setDescription(
|
||||||
|
`**${embedOptions.icons.shuffled} Shuffled queue tracks**\nThe tracks in the queue has been shuffled.\n\nView the new queue order with **\`/queue\`**.`
|
||||||
|
)
|
||||||
|
.setColor(embedOptions.colors.success)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -41,3 +41,23 @@ exports.queueNoCurrentTrack = async (interaction, queue) => {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.queueIsEmpty = async (interaction, queue) => {
|
||||||
|
if (queue.tracks.data.length === 0) {
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setDescription(
|
||||||
|
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks added to the queue. First add some tracks with **\`/play\`**!`
|
||||||
|
)
|
||||||
|
.setColor(embedOptions.colors.warning)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.debug(`User tried to use command ${interaction.commandName} but there was no tracks in the queue.`);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
Reference in new issue
Block a user