diff --git a/commands/music/activateMusic.js b/commands/admin/activateMusic.js similarity index 98% rename from commands/music/activateMusic.js rename to commands/admin/activateMusic.js index 7075013..d261f31 100644 --- a/commands/music/activateMusic.js +++ b/commands/admin/activateMusic.js @@ -8,7 +8,7 @@ module.exports = class leave extends Command { super(client, { name: 'activateMusic', - group:'music', + group:'admin', aliases: ['music','amusic'], description: 'Activates music for the guild. Can be called again to disable.', needsAdmin:true, diff --git a/lib.js b/lib.js index e5a58af..8ec4daf 100644 --- a/lib.js +++ b/lib.js @@ -49,6 +49,7 @@ class command { this.name = options.name; this.aliases = options.aliases; + this.group = options.group; this.description = options.description; this.needsAdmin =options.needsAdmin; this.hidden = options.hidden; @@ -74,9 +75,9 @@ class _Client extends Client if(typeof command === 'function') { let c = new command(this); - this.commands.set(c.name,{ needsAdmin: c.needsAdmin?c.needsAdmin:false, + group: c.group, command: command, }); if(c.aliases) @@ -85,6 +86,7 @@ class _Client extends Client { this.commands.set(c.aliases[i],{ needsAdmin: c.needsAdmin, + group: c.group, command: command, }); } @@ -186,7 +188,7 @@ class _Client extends Client */ async enableCommands() { - this.on("messageCreate", message=> + this.on("messageCreate", async (message)=> { this.checkForInvites(message); if(message.content.startsWith(process.env.prefix)) //Test prefix t! @@ -202,7 +204,8 @@ class _Client extends Client let isMusicRelated = this.commands.get(commandName).group == 'music'; if(isMusicRelated) { - if(!this.getMusicActive(message.guildId)) return new ErrorMessage(this).send(ErrorType.FeatureInnactive, message); + let isActive = await this.getMusicActive(message.guildId); + if(!isActive) return new ErrorMessage(this).send(ErrorType.FeatureInnactive, message); } let isAdmin =false; try