2022-01-04 02:18:28 +05:00
|
|
|
const Command = require("../../base/Command.js"),
|
|
|
|
Discord = require("discord.js");
|
|
|
|
|
|
|
|
class Back extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "back",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: ["previous"],
|
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args, data) {
|
|
|
|
const voice = message.member.voice.channel;
|
|
|
|
const queue = this.client.player.getQueue(message);
|
|
|
|
|
|
|
|
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
|
|
|
if (!queue) return message.error("music/play:NOT_PLAYING");
|
|
|
|
if (!queue.previousSongs[0]) return message.error("music/back:NO_PREV_SONG");
|
|
|
|
|
|
|
|
const embed = new Discord.MessageEmbed()
|
2022-01-05 00:24:57 +05:00
|
|
|
.setAuthor({
|
|
|
|
name: message.translate("music/back:DESCRIPTION")
|
|
|
|
})
|
2022-01-04 02:18:28 +05:00
|
|
|
.setThumbnail(queue.tracks[0].thumbnail)
|
2022-01-05 00:24:57 +05:00
|
|
|
.setColor(data.config.embed.color)
|
|
|
|
.setFooter({
|
|
|
|
text: data.config.embed.footer
|
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-01-05 00:24:57 +05:00
|
|
|
const m = await message.channel.send({
|
|
|
|
embeds: [embed]
|
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
this.client.player.previous(message);
|
|
|
|
embed.setDescription(message.translate("music/back:SUCCESS"));
|
2022-01-05 00:24:57 +05:00
|
|
|
m.edit({
|
|
|
|
embeds: [embed]
|
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
module.exports = Back;
|