mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
ed8cc4f0be
Мелкие правки
54 lines
No EOL
1.4 KiB
JavaScript
54 lines
No EOL
1.4 KiB
JavaScript
const { SlashCommandBuilder } = require("discord.js");
|
|
const BaseCommand = require("../../base/BaseCommand"),
|
|
ms = require("ms");
|
|
|
|
class Seek extends BaseCommand {
|
|
/**
|
|
*
|
|
* @param {import("../base/JaBa")} client
|
|
*/
|
|
constructor(client) {
|
|
super({
|
|
command: new SlashCommandBuilder()
|
|
.setName("seek")
|
|
.setDescription(client.translate("music/seek:DESCRIPTION"))
|
|
.addStringOption(option => option.setName("time")
|
|
.setDescription("music/seek:TIME")
|
|
.setRequired(true)),
|
|
aliases: [],
|
|
dirname: __dirname,
|
|
guildOnly: true,
|
|
ownerOnly: false
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @param {import("../../base/JaBa")} client
|
|
*/
|
|
async onLoad() {
|
|
//...
|
|
}
|
|
/**
|
|
*
|
|
* @param {import("../../base/JaBa")} client
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
* @param {Array} data
|
|
*/
|
|
async execute(client, interaction) {
|
|
const voice = interaction.member.voice.channel;
|
|
const queue = client.player.getQueue(interaction);
|
|
const time = ms(interaction.options.getString("time")) / 1000;
|
|
|
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
|
if (isNaN(time)) return interaction.error("music/seek:INVALID_TIME");
|
|
|
|
await client.player.seek(interaction, time);
|
|
|
|
interaction.replyT("music/seek:SUCCESS", {
|
|
time: ms(interaction.options.getString("time"))
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = Seek; |