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

View File

@ -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;