Skip to content

Commit

Permalink
Fix limit/clearlimit error on empty args
Browse files Browse the repository at this point in the history
  • Loading branch information
zajrik committed Feb 11, 2017
1 parent 02560b4 commit 5e8b6ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/command/base/groupcontrol/ClearLimit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class ClearLimit extends Command
async action(message, args, mentions) // eslint-disable-line no-unused-vars
{
let commandName = args[0];
if (!commandName) return this._respond(message, `You must provide a command to clear limits for.`);
let command = this.bot.commands.find(c => normalize(c.name) === normalize(commandName));
if (!command) return this._respond(message, `Failed to find a command with the name \`${commandName}\``);

Expand Down
1 change: 1 addition & 0 deletions src/lib/command/base/groupcontrol/Limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class Limit extends Command
async action(message, args, mentions) // eslint-disable-line no-unused-vars
{
let commandName = args.shift();
if (!commandName) return this._respond(message, `You must provide a command to limit.`);
const command = this.bot.commands.find(c => normalize(commandName) === normalize(c.name));
if (!command) return this._respond(message, `Failed to find a command with the name \`${commandName}\``);
if (command.group === 'base') this._respond(message, `Cannot limit base commands.`);
Expand Down

0 comments on commit 5e8b6ba

Please sign in to comment.