JaBa/commands/Music/loop.js

32 lines
790 B
JavaScript
Raw Normal View History

2021-12-19 16:36:46 +05:00
const Command = require("../../base/Command.js");
class Loop extends Command {
constructor (client) {
super(client, {
name: "loop",
dirname: __dirname,
enabled: true,
guildOnly: true,
2021-12-26 02:51:35 +05:00
aliases: [ "repeat" ],
2021-12-19 16:36:46 +05:00
memberPermissions: [],
botPermissions: [ "SEND_MESSAGES" ],
nsfw: false,
ownerOnly: false,
2021-12-26 00:04:26 +05:00
cooldown: 1000
2021-12-19 16:36:46 +05:00
});
}
async run (message, args) {
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");
2021-12-26 00:04:26 +05:00
const mode = this.client.player.setRepeatMode(message);
2021-12-19 20:38:49 +05:00
2021-12-26 00:04:26 +05:00
message.success(`music/loop:${mode ? mode === 2 ? "QUEUE" : "SONG" : "DISABLED"}`)
2021-12-19 16:36:46 +05:00
}
};
module.exports = Loop;