Command: add guildOnly flag
This commit is contained in:
parent
f98488a2df
commit
812fca8174
2 changed files with 5 additions and 0 deletions
|
@ -4,6 +4,7 @@ class Command {
|
|||
this.aliases = [];
|
||||
this.helpText = "No description provided.";
|
||||
this.category = "unsorted";
|
||||
this.guildOnly = false;
|
||||
}
|
||||
|
||||
addAlias(alias) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue