Fix MessageCollector#postCheck

This commit is contained in:
Crawl
2017-05-16 04:47:53 +02:00
parent 20a267c12f
commit 8beefe66d5

View File

@@ -3,7 +3,7 @@ const Collector = require('./interfaces/Collector');
/**
* @typedef {CollectorOptions} MessageCollectorOptions
* @property {number} max The maximum amount of messages to process
* @property {number} maxMatches The maximum amount of messages to collect
* @property {number} maxProcessed The maximum amount of messages to collect
*/
/**
@@ -56,9 +56,8 @@ class MessageCollector extends Collector {
* @private
*/
postCheck() {
// Consider changing the end reasons for v12
if (this.options.maxMatches && this.collected.size >= this.options.max) return 'matchesLimit';
if (this.options.max && this.received >= this.options.maxProcessed) return 'limit';
if (this.collected.size >= this.options.max) return 'limit';
else if (this.options.maxProcessed && this.received === this.options.maxProcessed) return 'processedLimit';
return null;
}