feat(interaction-router): Adds error handling
This commit is contained in:
parent
62a32c8222
commit
05d113cccf
1 changed files with 20 additions and 16 deletions
|
|
@ -37,22 +37,26 @@ export class InteractionRouter {
|
||||||
async route(interaction: Interaction) {
|
async route(interaction: Interaction) {
|
||||||
const interactionType = this.findInteractionType(interaction);
|
const interactionType = this.findInteractionType(interaction);
|
||||||
|
|
||||||
switch (interactionType) {
|
try {
|
||||||
case InteractionRoutingType.Unrouted:
|
switch (interactionType) {
|
||||||
this.logger.debug("Unroutable interaction found...")
|
case InteractionRoutingType.Unrouted:
|
||||||
break;
|
this.logger.debug("Unroutable interaction found...")
|
||||||
case InteractionRoutingType.Command:
|
break;
|
||||||
await this.handleCommand(<ChatInputCommandInteraction>interaction);
|
case InteractionRoutingType.Command:
|
||||||
break;
|
await this.handleCommand(<ChatInputCommandInteraction>interaction);
|
||||||
case InteractionRoutingType.AutoComplete:
|
break;
|
||||||
await this.handleAutocomplete(<AutocompleteInteraction>interaction)
|
case InteractionRoutingType.AutoComplete:
|
||||||
break;
|
await this.handleAutocomplete(<AutocompleteInteraction>interaction)
|
||||||
case InteractionRoutingType.ModalSubmit:
|
break;
|
||||||
this.events.dispatch(new ModalInteractionEvent(<ModalSubmitInteraction>interaction));
|
case InteractionRoutingType.ModalSubmit:
|
||||||
break;
|
this.events.dispatch(new ModalInteractionEvent(<ModalSubmitInteraction>interaction));
|
||||||
case InteractionRoutingType.ButtonSubmit:
|
break;
|
||||||
case InteractionRoutingType.MenuSubmit:
|
case InteractionRoutingType.ButtonSubmit:
|
||||||
this.events.dispatch(new ComponentInteractionEvent(<ButtonInteraction|AnySelectMenuInteraction>interaction))
|
case InteractionRoutingType.MenuSubmit:
|
||||||
|
this.events.dispatch(new ComponentInteractionEvent(<ButtonInteraction | AnySelectMenuInteraction>interaction))
|
||||||
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
this.logger.fatal(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue