JaBa/commands/Music/loop.js

32 lines
789 B
JavaScript
Raw Normal View History

2021-12-19 16:36:46 +05:00
const Command = require("../../base/Command.js");
class Loop extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-19 16:36:46 +05:00
super(client, {
name: "loop",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["repeat", "l"],
2021-12-19 16:36:46 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES"],
2021-12-19 16:36:46 +05:00
nsfw: false,
ownerOnly: false,
2021-12-26 00:04:26 +05:00
cooldown: 1000
2021-12-19 16:36:46 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args) {
2021-12-19 16:36:46 +05:00
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;