Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Collector): return a boolean on checkEnd #6289

Merged
merged 1 commit into from Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -450,7 +450,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