mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(Collector): return a boolean on checkEnd (#6289)
This commit is contained in:
@@ -207,7 +207,6 @@ class Collector extends EventEmitter {
|
||||
/**
|
||||
* Resets the collector's timeout and idle timer.
|
||||
* @param {CollectorResetTimerOptions} [options] Options for reseting
|
||||
|
||||
*/
|
||||
resetTimer({ time, idle } = {}) {
|
||||
if (this._timeout) {
|
||||
@@ -222,10 +221,12 @@ class Collector extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Checks whether the collector should end, and if so, ends it.
|
||||
* @returns {boolean} Whether the collector ended or not
|
||||
*/
|
||||
checkEnd() {
|
||||
const reason = this.endReason;
|
||||
if (reason) this.stop(reason);
|
||||
return Boolean(reason);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -474,7 +474,7 @@ export abstract class Collector<K, V, F extends unknown[] = []> extends EventEmi
|
||||
public filter: CollectorFilter<[V, ...F]>;
|
||||
public readonly next: Promise<V>;
|
||||
public options: CollectorOptions<[V, ...F]>;
|
||||
public checkEnd(): void;
|
||||
public checkEnd(): boolean;
|
||||
public handleCollect(...args: unknown[]): Promise<void>;
|
||||
public handleDispose(...args: unknown[]): Promise<void>;
|
||||
public stop(reason?: string): void;
|
||||
|
||||
Reference in New Issue
Block a user