2022-08-03 20:57:54 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js");
|
2022-08-02 17:18:47 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
2022-08-03 20:57:54 +05:00
|
|
|
class Skipto extends BaseCommand {
|
2022-08-02 17:18:47 +05:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
2022-08-03 20:57:54 +05:00
|
|
|
.setName("skipto")
|
|
|
|
.setDescription(client.translate("music/skipto:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
2023-07-05 00:58:06 +05:00
|
|
|
uk: client.translate("music/skipto:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("music/skipto:DESCRIPTION", null, "ru-RU"),
|
2023-06-15 19:46:27 +05:00
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false)
|
2023-07-05 00:58:06 +05:00
|
|
|
.addIntegerOption(option =>
|
|
|
|
option
|
|
|
|
.setName("position")
|
|
|
|
.setDescription(client.translate("music/skipto:POSITION"))
|
|
|
|
.setDescriptionLocalizations({
|
|
|
|
uk: client.translate("music/skipto:POSITION", null, "uk-UA"),
|
|
|
|
ru: client.translate("music/skipto:POSITION", null, "ru-RU"),
|
|
|
|
})
|
|
|
|
.setRequired(true),
|
|
|
|
),
|
2022-08-02 17:18:47 +05:00
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-02 17:18:47 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-08-02 17:18:47 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
|
|
|
const voice = interaction.member.voice.channel;
|
|
|
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
2023-01-09 01:39:13 +05:00
|
|
|
|
2023-03-24 00:09:26 +05:00
|
|
|
const queue = client.player.nodes.get(interaction.guildId);
|
2022-08-02 17:18:47 +05:00
|
|
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
2023-01-09 01:39:13 +05:00
|
|
|
|
|
|
|
const position = interaction.options.getInteger("position");
|
|
|
|
if (position <= 0) return interaction.error("music/skipto:NO_PREV_SONG");
|
2022-08-02 17:18:47 +05:00
|
|
|
|
2023-03-24 00:09:26 +05:00
|
|
|
if (queue.tracks.at(position - 1)) {
|
|
|
|
queue.node.skipTo(queue.tracks.at(position - 1));
|
2022-08-02 17:18:47 +05:00
|
|
|
|
2022-08-03 20:57:54 +05:00
|
|
|
interaction.success("music/skipto:SUCCESS", {
|
2023-10-29 18:23:56 +05:00
|
|
|
track: queue.tracks.at(position - 1).title,
|
2022-08-03 20:57:54 +05:00
|
|
|
});
|
2023-10-29 18:23:56 +05:00
|
|
|
} else return interaction.error("music/skipto:ERROR", { position });
|
2022-08-02 17:18:47 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Skipto;
|