From 44b0a6354f8a13018408b7c4f97fd1fa4e458d16 Mon Sep 17 00:00:00 2001 From: MARCROCK22 <57925328+MARCROCK22@users.noreply.github.com> Date: Fri, 10 May 2024 21:22:59 -0400 Subject: [PATCH] fix: apply extendContext to ModalContext --- src/client/base.ts | 2 ++ src/client/oninteractioncreate.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/base.ts b/src/client/base.ts index c733a27..71147dc 100644 --- a/src/client/base.ts +++ b/src/client/base.ts @@ -35,6 +35,7 @@ import type { ComponentInteraction, Message, MessageCommandInteraction, + ModalSubmitInteraction, UserCommandInteraction, } from '../structures'; @@ -333,6 +334,7 @@ export interface BaseClientOptions { | UserCommandInteraction | MessageCommandInteraction | ComponentInteraction + | ModalSubmitInteraction | When, ) => {}; globalMiddlewares?: readonly (keyof RegisteredMiddlewares)[]; diff --git a/src/client/oninteractioncreate.ts b/src/client/oninteractioncreate.ts index e30ee24..8448f92 100644 --- a/src/client/oninteractioncreate.ts +++ b/src/client/oninteractioncreate.ts @@ -219,7 +219,10 @@ export async function onInteractionCreate( if (self.components?.hasModal(interaction)) { await self.components.onModalSubmit(interaction); } else { - await self.components?.executeModal(new ModalContext(self, interaction)); + const context = new ModalContext(self, interaction); + const extended = self.options?.context?.(interaction) ?? {}; + Object.assign(context, extended); + await self.components?.executeModal(context); } } break;