Skip to content

Commit

Permalink
chore: fine-tune ChatInputSubcommandDenied internally
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Oct 26, 2023
1 parent d0df8aa commit c29f52a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/subcommands/src/lib/Subcommand.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
Command,
PreconditionContainerArray,
PreconditionResolvers,
Result,
UserError,
PreconditionResolvers,
type Args,
type ChatInputCommand,
type MessageCommand,
Expand All @@ -16,6 +16,7 @@ import {
SubcommandPluginEvents,
SubcommandPluginIdentifiers,
type ChatInputSubcommandAcceptedPayload,
type ChatInputSubcommandDeniedPayload,
type MessageSubcommandAcceptedPayload
} from './types/Events';
import type {
Expand Down Expand Up @@ -480,7 +481,11 @@ export class Subcommand<PreParseReturn extends Args = Args, O extends Subcommand
// Run the subcommand specific preconditions:
const localSubcommandResult = await preconditionsForSubcommand.chatInputRun(interaction, this, payload as any);
if (localSubcommandResult.isErr()) {
this.container.client.emit(SubcommandPluginEvents.ChatInputSubCommandDenied, localSubcommandResult.unwrapErr(), payload);
this.container.client.emit(
SubcommandPluginEvents.ChatInputSubcommandDenied,
localSubcommandResult.unwrapErr(),
payload as ChatInputSubcommandDeniedPayload
);
return;
}
}
Expand Down

0 comments on commit c29f52a

Please sign in to comment.