fix: apply extendContext to ModalContext

This commit is contained in:
MARCROCK22 2024-05-10 21:22:59 -04:00
parent 92c39b91c4
commit 44b0a6354f
2 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import type {
ComponentInteraction, ComponentInteraction,
Message, Message,
MessageCommandInteraction, MessageCommandInteraction,
ModalSubmitInteraction,
UserCommandInteraction, UserCommandInteraction,
} from '../structures'; } from '../structures';
@ -333,6 +334,7 @@ export interface BaseClientOptions {
| UserCommandInteraction<boolean> | UserCommandInteraction<boolean>
| MessageCommandInteraction<boolean> | MessageCommandInteraction<boolean>
| ComponentInteraction | ComponentInteraction
| ModalSubmitInteraction
| When<InferWithPrefix, Message, never>, | When<InferWithPrefix, Message, never>,
) => {}; ) => {};
globalMiddlewares?: readonly (keyof RegisteredMiddlewares)[]; globalMiddlewares?: readonly (keyof RegisteredMiddlewares)[];

View File

@ -219,7 +219,10 @@ export async function onInteractionCreate(
if (self.components?.hasModal(interaction)) { if (self.components?.hasModal(interaction)) {
await self.components.onModalSubmit(interaction); await self.components.onModalSubmit(interaction);
} else { } 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; break;