35 lines
951 B
TypeScript
35 lines
951 B
TypeScript
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
|
|
|
|
import Client from "$lib/client.js";
|
|
import logger from "$lib/logger.js";
|
|
|
|
import replies from "../lib/replies.js";
|
|
import { controller } from "../module.js";
|
|
|
|
async function execute(client: Client, interaction: ChatInputCommandInteraction) {
|
|
if (!interaction.isChatInputCommand() || !interaction.inCachedGuild() || !interaction.channel) {
|
|
logger.warn("Interaction rejected.", { interaction });
|
|
|
|
return;
|
|
}
|
|
|
|
const player = controller.get(interaction.guild, interaction.channel);
|
|
|
|
if (!player) {
|
|
await interaction.reply(replies.notExists());
|
|
|
|
return;
|
|
}
|
|
|
|
player.shuffle();
|
|
|
|
await interaction.reply(replies.reshuffle());
|
|
}
|
|
|
|
const data = new SlashCommandBuilder()
|
|
.setName("reshuffle")
|
|
.setDescription("Reshuffle the queue. (Will change queue order)")
|
|
.setDMPermission(false);
|
|
|
|
export { data, execute };
|