diff --git a/src/lib/command.js b/src/lib/command.js index 54e000f..10805f2 100644 --- a/src/lib/command.js +++ b/src/lib/command.js @@ -4,6 +4,7 @@ class Command { this.aliases = []; this.helpText = "No description provided."; this.category = "unsorted"; + this.guildOnly = false; } addAlias(alias) { diff --git a/src/lib/commandDispatcher.js b/src/lib/commandDispatcher.js index f645658..a7ab4d8 100644 --- a/src/lib/commandDispatcher.js +++ b/src/lib/commandDispatcher.js @@ -37,6 +37,10 @@ async function runCommand(msg, cmd, line, args) { return "No\n\nSent from my iPhone."; } + if (cmdObj.guildOnly && !msg.channel.guild) { + return "This command can only be used in guilds."; + } + try { const ret = cmdObj.callback(msg, line, ...args); if (ret instanceof Promise) {