From b814db8dd6d0e3df0d78388e9a1d410eede8e6e8 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 2 May 2020 21:03:34 -0400 Subject: [PATCH] fixes for command arguments --- src/commands/ban.ts | 1 + src/commands/npm.ts | 2 +- src/commands/roleinfo.ts | 2 +- src/commands/unban.ts | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index e8e43d5..eee1893 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -15,6 +15,7 @@ export default class Ban extends Command { public async run(message: Message, args: string[]) { try { + if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); const member = this.client.util.resolveMember(args[0], this.client.guilds.get(this.client.config.guildID)); let user: User; if (!member) { diff --git a/src/commands/npm.ts b/src/commands/npm.ts index fae9cff..2ed756e 100644 --- a/src/commands/npm.ts +++ b/src/commands/npm.ts @@ -15,7 +15,7 @@ export default class NPM extends Command { public async run(message: Message, args: string[]) { try { - if (!args[0]) return this.error(message.channel, 'You need to specify a module name.'); + if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); const res = await axios.get(`https://registry.npmjs.com/${args[0]}`, { validateStatus: (_) => true }); diff --git a/src/commands/roleinfo.ts b/src/commands/roleinfo.ts index a617ec3..fb39158 100644 --- a/src/commands/roleinfo.ts +++ b/src/commands/roleinfo.ts @@ -15,7 +15,7 @@ export default class Roleinfo extends Command { public async run(message: Message, args: string[]) { try { - if (!args[0]) return this.error(message.channel, 'You need to specify a role ID or a role name.'); + if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); let role: Role = this.client.guilds.get(this.client.config.guildID).roles.find((r: Role) => r.id === args[0]); if (!role) { // if it's a role name diff --git a/src/commands/unban.ts b/src/commands/unban.ts index a0a4fbc..3eb0cae 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -14,6 +14,7 @@ export default class Unban extends Command { public async run(message: Message, args: string[]) { try { + if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); let user: User; try { user = await this.client.getRESTUser(args[0]);