Command: add guildOnly flag

This commit is contained in:
Cynthia Foxwell 2021-03-14 20:30:09 -06:00
parent f98488a2df
commit 812fca8174
2 changed files with 5 additions and 0 deletions

View file

@ -4,6 +4,7 @@ class Command {
this.aliases = [];
this.helpText = "No description provided.";
this.category = "unsorted";
this.guildOnly = false;
}
addAlias(alias) {

View file

@ -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) {