diff --git a/source/Discord/InteractionRouter.ts b/source/Discord/InteractionRouter.ts index fb11eff..1a20ba5 100644 --- a/source/Discord/InteractionRouter.ts +++ b/source/Discord/InteractionRouter.ts @@ -37,22 +37,26 @@ export class InteractionRouter { async route(interaction: Interaction) { const interactionType = this.findInteractionType(interaction); - switch (interactionType) { - case InteractionRoutingType.Unrouted: - this.logger.debug("Unroutable interaction found...") - break; - case InteractionRoutingType.Command: - await this.handleCommand(interaction); - break; - case InteractionRoutingType.AutoComplete: - await this.handleAutocomplete(interaction) - break; - case InteractionRoutingType.ModalSubmit: - this.events.dispatch(new ModalInteractionEvent(interaction)); - break; - case InteractionRoutingType.ButtonSubmit: - case InteractionRoutingType.MenuSubmit: - this.events.dispatch(new ComponentInteractionEvent(interaction)) + try { + switch (interactionType) { + case InteractionRoutingType.Unrouted: + this.logger.debug("Unroutable interaction found...") + break; + case InteractionRoutingType.Command: + await this.handleCommand(interaction); + break; + case InteractionRoutingType.AutoComplete: + await this.handleAutocomplete(interaction) + break; + case InteractionRoutingType.ModalSubmit: + this.events.dispatch(new ModalInteractionEvent(interaction)); + break; + case InteractionRoutingType.ButtonSubmit: + case InteractionRoutingType.MenuSubmit: + this.events.dispatch(new ComponentInteractionEvent(interaction)) + } + } catch (err: any) { + this.logger.fatal(err); } }