2022-08-26 00:31:42 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js");
|
2022-08-02 17:18:47 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Back extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("back")
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDescription(client.translate("music/back:DESCRIPTION"))
|
|
|
|
.setDMPermission(false),
|
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", null, { ephemeral: true });
|
2022-08-03 20:57:54 +05:00
|
|
|
const queue = client.player.getQueue(interaction.guildId);
|
2022-08-02 17:18:47 +05:00
|
|
|
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true });
|
2022-08-03 20:57:54 +05:00
|
|
|
if (!queue.previousTracks[0]) return interaction.error("music/back:NO_PREV_SONG", null, { ephemeral: true });
|
2022-08-02 17:18:47 +05:00
|
|
|
|
2022-08-26 00:31:42 +05:00
|
|
|
queue.back();
|
|
|
|
interaction.success("music/back:SUCCESS");
|
2022-08-02 17:18:47 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Back;
|