Home > Blockchain >  How to remove collector in Discord.js?
How to remove collector in Discord.js?

Time:10-07

I use collector to get information. I get the information. So i want to deactivate it. But delete collector; is not work. How can i do that?

CodePudding user response:

You might be looking for Collector#stop() function:

// `collector` is a Collector instance
collector.on("collect", () => {
  // ...
  if (someCondition) {
    collector.stop(); // This stops the collector from firing events again
  }
});

relevant docs

CodePudding user response:

The Collector#stop method would be useful for that, it accepts one parameter that is an array of reasons and further emits the Collector#end event.

collector.on("collect", () => {
    collector.stop();
});
  • Related