Skip to content

Commit

Permalink
Linting and undefined variable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abalabahaha committed Jan 19, 2018
1 parent 80f6c58 commit 5a38e11
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/command/CommandClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,22 @@ class CommandClient extends Client {
if(msg.command.hooks.postExecution) {
msg.command.hooks.postExecution(msg, args, false);
}
var promise = Promise.resolve();
if(msg.command.errorMessage) {
if(typeof msg.command.errorMessage === "function") {
var reply = msg.command.errorMessage();
if(reply !== undefined) {
this.createMessage(msg.channel.id, reply);
promise = this.createMessage(msg.channel.id, reply);
}
}else{
this.createMessage(msg.channel.id, msg.command.errorMessage);
} else {
promise = this.createMessage(msg.channel.id, msg.command.errorMessage);
}
}
if(msg.command.hooks.postCommand) {
msg.command.hooks.postCommand(msg, args, newMsg);
}
promise.then((newMsg) => {
if(msg.command.hooks.postCommand) {
msg.command.hooks.postCommand(msg, args, newMsg);
}
});
});
}
}
Expand Down

0 comments on commit 5a38e11

Please sign in to comment.