From d634694c3fd52e48101230b41cb6144bfcd873b2 Mon Sep 17 00:00:00 2001 From: Ali <149781771+z9z@users.noreply.github.com> Date: Tue, 1 Sep 2026 01:25:15 +0400 Subject: [PATCH] fix: update collector options.time and options.idle in resetTimer (#11534) * fix(Collector): update options.time and options.idle in resetTimer * fix: apply suggestions from code review Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com> --------- Co-authored-by: Almeida Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com> --- .../src/structures/interfaces/Collector.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/discord.js/src/structures/interfaces/Collector.js b/packages/discord.js/src/structures/interfaces/Collector.js index a5fde7db4..f3b1f3855 100644 --- a/packages/discord.js/src/structures/interfaces/Collector.js +++ b/packages/discord.js/src/structures/interfaces/Collector.js @@ -272,14 +272,22 @@ class Collector extends AsyncEventEmitter { * @param {CollectorResetTimerOptions} [options] Options for resetting */ resetTimer({ time, idle } = {}) { + if (time) { + this.options.time = time; + } + + if (idle) { + this.options.idle = idle; + } + if (this._timeout) { clearTimeout(this._timeout); - this._timeout = setTimeout(() => this.stop('time'), time ?? this.options.time).unref(); + this._timeout = setTimeout(() => this.stop('time'), this.options.time).unref(); } if (this._idletimeout) { clearTimeout(this._idletimeout); - this._idletimeout = setTimeout(() => this.stop('idle'), idle ?? this.options.idle).unref(); + this._idletimeout = setTimeout(() => this.stop('idle'), this.options.idle).unref(); } }