mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-25 22:55:00 +05:00
41 lines
No EOL
1.3 KiB
JavaScript
41 lines
No EOL
1.3 KiB
JavaScript
const Command = require("../../base/Command.js");
|
|
|
|
class Loop extends Command {
|
|
constructor (client) {
|
|
super(client, {
|
|
name: "loop",
|
|
dirname: __dirname,
|
|
enabled: true,
|
|
guildOnly: true,
|
|
aliases: [],
|
|
memberPermissions: [],
|
|
botPermissions: [ "SEND_MESSAGES" ],
|
|
nsfw: false,
|
|
ownerOnly: false,
|
|
cooldown: 3000
|
|
});
|
|
}
|
|
|
|
async run (message, args) {
|
|
const voice = message.member.voice.channel;
|
|
const queue = this.client.player.getQueue(message);
|
|
|
|
if (!args[0] || !["queue", "song"].includes(args[0])) return message.error("music/loop:NO_ARG");
|
|
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
|
if (!queue) return message.error("music/play:NOT_PLAYING");
|
|
|
|
if (args[0].toLowerCase() === "queue") {
|
|
if (queue.repeatMode) this.client.player.setRepeatMode(message, false);
|
|
|
|
this.client.player.setLoopMode(message, !queue.loopMode);
|
|
message.success(`music/loop:QUEUE_SUCCESS_${queue.loopMode ? "ENABLED" : "DISABLED"}`)
|
|
} else if (args[0].toLowerCase() === "song") {
|
|
if (queue.loopMode) this.client.player.setLoopMode(message, false);
|
|
|
|
this.client.player.setRepeatMode(message, !queue.repeatMode);
|
|
message.success(`music/loop:SONG_SUCCESS_${queue.repeatMode ? "ENABLED" : "DISABLED"}`);
|
|
};
|
|
}
|
|
};
|
|
|
|
module.exports = Loop; |