JaBa/commands/Music/back.js
JonnyBro c76bfc3664 v3.3.9
Команда emoji
Мелкие правки
Бот отвечает на команду, а не пишет в тот же канал
2022-02-13 17:26:12 +05:00

50 lines
No EOL
1.2 KiB
JavaScript

const Command = require("../../base/Command"),
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()
.setAuthor({
name: message.translate("music/back:DESCRIPTION")
})
.setThumbnail(queue.tracks[0].thumbnail)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
const m = await message.reply({
embeds: [embed]
});
this.client.player.previous(message);
embed.setDescription(message.translate("music/back:SUCCESS"));
m.edit({
embeds: [embed]
});
}
}
module.exports = Back;