2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
class Loop extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "loop",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: ["repeat", "l"],
|
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: ["SEND_MESSAGES"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
2022-02-04 17:02:07 +05:00
|
|
|
const type = args[0];
|
2022-01-09 23:20:06 +05:00
|
|
|
let mode = null;
|
|
|
|
if (type === "queue") {
|
|
|
|
mode = this.client.player.setRepeatMode(message, 2);
|
|
|
|
} else if (type === "song") {
|
|
|
|
mode = this.client.player.setRepeatMode(message, 1);
|
|
|
|
} else {
|
|
|
|
mode = this.client.player.setRepeatMode(message, 0);
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-01-13 00:26:23 +05:00
|
|
|
message.success(`music/loop:${mode ? mode === 2 ? "QUEUE" : "SONG" : "DISABLED"}`);
|
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 = Loop;
|