seyfert 2.2.1-dev-13377648432.0 → 2.2.1-dev-13380910405.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.
|
@@ -10,7 +10,8 @@ export interface ComponentCommand {
|
|
|
10
10
|
export declare abstract class ComponentCommand {
|
|
11
11
|
type: 0;
|
|
12
12
|
abstract componentType: keyof ContextComponentCommandInteractionMap;
|
|
13
|
-
|
|
13
|
+
customId?: string;
|
|
14
|
+
filter?(context: ComponentContext<typeof this.componentType>): Promise<boolean> | boolean;
|
|
14
15
|
abstract run(context: ComponentContext<typeof this.componentType>): any;
|
|
15
16
|
middlewares: (keyof RegisteredMiddlewares)[];
|
|
16
17
|
props: ExtraProps;
|
|
@@ -8,6 +8,14 @@ exports.InteractionCommandType = {
|
|
|
8
8
|
};
|
|
9
9
|
class ComponentCommand {
|
|
10
10
|
type = exports.InteractionCommandType.COMPONENT;
|
|
11
|
+
customId;
|
|
12
|
+
/** @internal */
|
|
13
|
+
async _filter(context) {
|
|
14
|
+
const old = (await this.filter?.(context)) ?? true;
|
|
15
|
+
if (this.customId)
|
|
16
|
+
return this.customId === context.customId && old;
|
|
17
|
+
return old;
|
|
18
|
+
}
|
|
11
19
|
middlewares = [];
|
|
12
20
|
props;
|
|
13
21
|
get cType() {
|
|
@@ -257,7 +257,7 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
257
257
|
try {
|
|
258
258
|
if (i.type === componentcommand_1.InteractionCommandType.COMPONENT &&
|
|
259
259
|
i.cType === context.interaction.componentType &&
|
|
260
|
-
(await i.
|
|
260
|
+
(await i._filter(context))) {
|
|
261
261
|
context.command = i;
|
|
262
262
|
await this.execute(i, context);
|
|
263
263
|
}
|
|
@@ -270,7 +270,7 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
270
270
|
async executeModal(context) {
|
|
271
271
|
for (const i of this.commands) {
|
|
272
272
|
try {
|
|
273
|
-
if (i.type === componentcommand_1.InteractionCommandType.MODAL && (await i.
|
|
273
|
+
if (i.type === componentcommand_1.InteractionCommandType.MODAL && (await i._filter(context))) {
|
|
274
274
|
context.command = i;
|
|
275
275
|
await this.execute(i, context);
|
|
276
276
|
}
|
|
@@ -5,7 +5,8 @@ export interface ModalCommand {
|
|
|
5
5
|
}
|
|
6
6
|
export declare abstract class ModalCommand {
|
|
7
7
|
type: 1;
|
|
8
|
-
|
|
8
|
+
filter?(context: ModalContext): Promise<boolean> | boolean;
|
|
9
|
+
customId?: string;
|
|
9
10
|
abstract run(context: ModalContext): any;
|
|
10
11
|
middlewares: (keyof RegisteredMiddlewares)[];
|
|
11
12
|
props: ExtraProps;
|
|
@@ -4,6 +4,14 @@ exports.ModalCommand = void 0;
|
|
|
4
4
|
const componentcommand_1 = require("./componentcommand");
|
|
5
5
|
class ModalCommand {
|
|
6
6
|
type = componentcommand_1.InteractionCommandType.MODAL;
|
|
7
|
+
customId;
|
|
8
|
+
/** @internal */
|
|
9
|
+
async _filter(context) {
|
|
10
|
+
const old = (await this.filter?.(context)) ?? true;
|
|
11
|
+
if (this.customId)
|
|
12
|
+
return this.customId === context.customId && old;
|
|
13
|
+
return old;
|
|
14
|
+
}
|
|
7
15
|
middlewares = [];
|
|
8
16
|
props;
|
|
9
17
|
}
|