mirror of
https://github.com/danbulant/discord.js
synced 2026-06-06 08:11:50 +00:00
Fix MessageCollector.next edge case (#765)
This commit is contained in:
parent
1fcc618532
commit
d35372d3e9
1 changed files with 5 additions and 0 deletions
|
|
@ -100,6 +100,11 @@ class MessageCollector extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
get next() {
|
get next() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if (this.ended) {
|
||||||
|
reject(this.collected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const cleanup = () => {
|
const cleanup = () => {
|
||||||
this.removeListener('message', onMessage);
|
this.removeListener('message', onMessage);
|
||||||
this.removeListener('end', onEnd);
|
this.removeListener('end', onEnd);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue