-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Description
Which package is this bug report for?
discord.js
Issue description
The Collector#resetTimer method does not properly update the collector's timers after changing the idle value. Even after calling resetTimer with a new idle or time, the collector continues to use the old timers. This makes the method ineffective in scenarios where the idle timeout needs to be extended dynamically.
Steps to reproduce
- Create a collector with an initial
idletime. - Wait some time and then call
collector.resetTimer({ idle: newIdleValue }). - Observe that the old idle timer still triggers, and the collector does not reflect the new
idlevalue incollector.options.idle.
Expected behavior
- The old timers should be cleared.
- New timers should start based on the updated
idleandtimevalues. collector.options.idleandcollector.options.timeshould reflect the new values.
Code sample
const collector = msg.createMessageComponentCollector({
filter: (i) => i.user.id === author,
time: 5 * 60_000, // 5 minutes
idle: 60_000, // 1 minute
});
collector.on("collect", async (i: ButtonInteraction | StringSelectMenuInteraction) => {
// Example: when the "start" button is pressed, attempt to reset timer
if (i.isButton() && i.customId === "start") {
const newTime = 15 * 60_000; // 15 minutes
collector.resetTimer({
time: newTime,
idle: newTime,
});
// Debug logs
console.log("Collector timer reset called:");
console.log("Options.time:", collector.options.time);
console.log("Options.idle:", collector.options.idle);
}
});
collector.on("end", (collected, reason) => {
console.log(`Collector ended: ${reason}`);
});Versions
- discord.js version: 14.22.1
- Node.js version: v20.18.1
- OS: windows 10
Issue priority
Low (slightly annoying)
Which partials do you have configured?
Channel, Message, GuildMember, User, ThreadMember
Which gateway intents are you subscribing to?
No Intents, Not applicable
I have tested this issue on a development release
No response