Skip to content

Commit

Permalink
feat(Collector): return a boolean on checkEnd (#6289)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Aug 5, 2021
1 parent b4afcf8 commit f473f43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/structures/interfaces/Collector.js
Expand Up @@ -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) {
Expand All @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Expand Up @@ -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;
Expand Down

0 comments on commit f473f43

Please sign in to comment.