seyfert 3.2.1 → 3.2.2
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.
|
@@ -29,7 +29,7 @@ export type ComponentCommands = ComponentCommand | ModalCommand;
|
|
|
29
29
|
export interface CreateComponentCollectorResult {
|
|
30
30
|
run<T extends CollectorInteraction = CollectorInteraction>(customId: UserMatches, callback: ComponentCallback<T>): void;
|
|
31
31
|
stop(reason?: string): void;
|
|
32
|
-
waitFor<T extends CollectorInteraction = CollectorInteraction>(customId: UserMatches): Promise<T | null>;
|
|
32
|
+
waitFor<T extends CollectorInteraction = CollectorInteraction>(customId: UserMatches, timeout?: number): Promise<T | null>;
|
|
33
33
|
resetTimeouts(): void;
|
|
34
34
|
}
|
|
35
35
|
export declare class ComponentHandler extends BaseHandler {
|
|
@@ -73,22 +73,21 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
73
73
|
this.createComponentCollector(messageId, channelId, guildId, options, old.components);
|
|
74
74
|
});
|
|
75
75
|
},
|
|
76
|
-
waitFor: customId => new Promise(resolve => {
|
|
76
|
+
waitFor: (customId, timeout) => new Promise(resolve => {
|
|
77
77
|
const collector = this.values.get(messageId);
|
|
78
78
|
if (!collector)
|
|
79
79
|
return resolve(null);
|
|
80
|
+
let nodeTimeout;
|
|
80
81
|
this.values.get(messageId).__run(customId, interaction => {
|
|
81
|
-
|
|
82
|
+
clearTimeout(nodeTimeout);
|
|
82
83
|
//@ts-expect-error generic
|
|
83
84
|
resolve(interaction);
|
|
84
85
|
});
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// by default 15 seconds in case user don't do anything
|
|
91
|
-
}, collector?.options?.timeout ?? 15_000);
|
|
86
|
+
if (timeout && timeout > 0)
|
|
87
|
+
nodeTimeout = setTimeout(() => {
|
|
88
|
+
resolve(null);
|
|
89
|
+
// by default 15 seconds in case user don't do anything
|
|
90
|
+
}, timeout);
|
|
92
91
|
}),
|
|
93
92
|
resetTimeouts: () => {
|
|
94
93
|
this.resetTimeouts(messageId);
|
package/package.json
CHANGED