1
0
Fork 0
mirror of https://github.com/JonnyBro/JaBa.git synced 2024-12-23 11:53:02 +05:00
JaBa/commands/Music/seek.js

56 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-09-19 23:58:06 +05:00
const { SlashCommandBuilder, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Seek extends BaseCommand {
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../base/Client")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("seek")
.setDescription(client.translate("music/seek:DESCRIPTION"))
.setDescriptionLocalizations({
2023-07-05 00:58:06 +05:00
uk: client.translate("music/seek:DESCRIPTION", null, "uk-UA"),
ru: client.translate("music/seek:DESCRIPTION", null, "ru-RU"),
})
.setIntegrationTypes([ApplicationIntegrationType.GuildInstall])
.setContexts([InteractionContextType.Guild])
2023-07-05 00:58:06 +05:00
.addIntegerOption(option =>
option
.setName("time")
.setDescription(client.translate("music/seek:TIME"))
.setDescriptionLocalizations({
uk: client.translate("music/seek:TIME", null, "uk-UA"),
ru: client.translate("music/seek:TIME", null, "ru-RU"),
})
.setRequired(true),
),
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
async execute(client, interaction) {
const time = interaction.options.getInteger("time"),
voice = interaction.member.voice.channel;
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
2024-04-30 12:19:44 +05:00
const queue = client.player.nodes.get(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING");
2024-04-30 12:19:44 +05:00
queue.node.seek(time * 1000);
interaction.success("music/seek:SUCCESS", {
time: `**${time}** ${client.functions.getNoun(time, interaction.translate("misc:NOUNS:SECONDS:1"), interaction.translate("misc:NOUNS:SECONDS:2"), interaction.translate("misc:NOUNS:SECONDS:5"))}`,
});
}
}
2023-07-05 00:58:06 +05:00
module.exports = Seek;