From 31aae6a86bcb85b99078e010991d0ff8347e60e4 Mon Sep 17 00:00:00 2001 From: Anima <18208134+animafps@users.noreply.github.com> Date: Mon, 11 Oct 2021 11:23:57 +1300 Subject: [PATCH] feat: added better command error handling and replying re #119 --- src/arguments/array-object.ts | 2 +- src/arguments/yaw.ts | 4 ++-- src/listeners/commands/commandError.ts | 22 +++++++++++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/arguments/array-object.ts b/src/arguments/array-object.ts index 97801b0..a0baee7 100644 --- a/src/arguments/array-object.ts +++ b/src/arguments/array-object.ts @@ -17,7 +17,7 @@ export default class GameArgument extends Argument { return this.error({ parameter, message: '', - identifier: 'gameNoSupport', + identifier: 'gameObjectNoSupport', context, }) } diff --git a/src/arguments/yaw.ts b/src/arguments/yaw.ts index a5cb78b..aaff450 100644 --- a/src/arguments/yaw.ts +++ b/src/arguments/yaw.ts @@ -14,8 +14,8 @@ export default class YawArgument extends Argument { } else { return this.error({ parameter, - message: 'Game not supported.', - identifier: 'gameNoSupport', + message: 'Game not supported or a valid yaw value.', + identifier: 'yawNoSupport', context, }) } diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 2a68be6..fd0eab1 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -24,7 +24,27 @@ export default class UserListener extends Listener { case 'floatError': void message.reply( - `\`${error.parameter}\` is not a valid decimal.` + `\`${error.parameter}\` is not a valid decimal. + > **Tip**: You can do \`${args.commandContext.prefix}help ${args.command.name}\` to find out how to use this command.` + ) + break + + case 'gameObjectNoSupport': + void message.reply( + `\`${error.parameter}\` is not a valid object type. Must be either 'film', 'yaw', 'alias' or 'name'` + ) + break + + case 'badFILMNotation': + void message.reply( + `\`${error.parameter}\` is not valid FILM notation.` + ) + break + + case 'yawNoSupport': + void message.reply( + `\`${error.parameter}\` is not a valid decimal or supported game + > **Tip**: You can do \`${args.commandContext.prefix}games\` to see all the supported games.` ) break