seyfert 4.0.1-dev-19573177583.0 → 4.0.1-dev-19808765304.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/modalcommand.d.ts +1 -1
- package/lib/components/modalcommand.js +5 -2
- package/lib/components/modalcontext.d.ts +2 -2
- package/lib/structures/Interaction.d.ts +2 -2
- package/lib/structures/Interaction.js +2 -2
- package/lib/types/payloads/_interactions/modalSubmit.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export interface ModalCommand {
|
|
|
6
6
|
export declare abstract class ModalCommand {
|
|
7
7
|
type: 1;
|
|
8
8
|
filter?(context: ModalContext): Promise<boolean> | boolean;
|
|
9
|
-
customId?: string;
|
|
9
|
+
customId?: string | RegExp;
|
|
10
10
|
abstract run(context: ModalContext): any;
|
|
11
11
|
middlewares: (keyof RegisteredMiddlewares)[];
|
|
12
12
|
props: ExtraProps;
|
|
@@ -7,8 +7,11 @@ class ModalCommand {
|
|
|
7
7
|
customId;
|
|
8
8
|
/** @internal */
|
|
9
9
|
_filter(context) {
|
|
10
|
-
if (this.customId
|
|
11
|
-
|
|
10
|
+
if (this.customId) {
|
|
11
|
+
const matches = typeof this.customId === 'string' ? this.customId === context.customId : context.customId.match(this.customId);
|
|
12
|
+
if (!matches)
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
12
15
|
if (this.filter)
|
|
13
16
|
return this.filter(context);
|
|
14
17
|
return true;
|
|
@@ -23,12 +23,12 @@ export declare class ModalContext<M extends keyof RegisteredMiddlewares = never>
|
|
|
23
23
|
globalMetadata: GlobalMetadata;
|
|
24
24
|
get customId(): string;
|
|
25
25
|
get components(): {
|
|
26
|
-
component
|
|
26
|
+
component?: {
|
|
27
27
|
type: import("../types").ComponentType;
|
|
28
28
|
customId: string;
|
|
29
29
|
value?: string | undefined;
|
|
30
30
|
values?: string[] | undefined;
|
|
31
|
-
};
|
|
31
|
+
} | undefined;
|
|
32
32
|
type: import("../types").ComponentType.ActionRow;
|
|
33
33
|
}[];
|
|
34
34
|
/**
|
|
@@ -199,12 +199,12 @@ export declare class ModalSubmitInteraction<FromGuild extends boolean = boolean>
|
|
|
199
199
|
deferUpdate<WR extends boolean = false>(withResponse?: WR): Promise<When<WR, WebhookMessageStructure, undefined>>;
|
|
200
200
|
get customId(): string;
|
|
201
201
|
get components(): {
|
|
202
|
-
component
|
|
202
|
+
component?: {
|
|
203
203
|
type: ComponentType;
|
|
204
204
|
customId: string;
|
|
205
205
|
value?: string | undefined;
|
|
206
206
|
values?: string[] | undefined;
|
|
207
|
-
};
|
|
207
|
+
} | undefined;
|
|
208
208
|
type: ComponentType.ActionRow;
|
|
209
209
|
}[];
|
|
210
210
|
getInputValue(customId: string, required: true): string | string[];
|
|
@@ -525,9 +525,9 @@ let ModalSubmitInteraction = class ModalSubmitInteraction extends BaseInteractio
|
|
|
525
525
|
}
|
|
526
526
|
getInputValue(customId, required) {
|
|
527
527
|
let value;
|
|
528
|
-
const get = this.components.find(x => x.component.customId === customId);
|
|
528
|
+
const get = this.components.find(x => x.component && x.component.customId === customId);
|
|
529
529
|
if (get) {
|
|
530
|
-
value = get.component
|
|
530
|
+
value = get.component?.value ?? get.component?.values;
|
|
531
531
|
}
|
|
532
532
|
if ((!value || value.length === 0) && required)
|
|
533
533
|
throw new Error(`${customId} component doesn't have a value`);
|
|
@@ -7,7 +7,7 @@ export interface ModalSubmitComponent {
|
|
|
7
7
|
values?: string[];
|
|
8
8
|
}
|
|
9
9
|
export interface ModalSubmitActionRowComponent extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
|
|
10
|
-
component
|
|
10
|
+
component?: ModalSubmitComponent;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure
|