mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 21:13:30 +01:00
fix(Collector): throw an error if a non-function was provided as filter (#5034)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const EventEmitter = require('events');
|
const EventEmitter = require('events');
|
||||||
|
const { TypeError } = require('../../errors');
|
||||||
const Collection = require('../../util/Collection');
|
const Collection = require('../../util/Collection');
|
||||||
const Util = require('../../util/Util');
|
const Util = require('../../util/Util');
|
||||||
|
|
||||||
@@ -74,6 +75,10 @@ class Collector extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
this._idletimeout = null;
|
this._idletimeout = null;
|
||||||
|
|
||||||
|
if (typeof filter !== 'function') {
|
||||||
|
throw new TypeError('INVALID_TYPE', 'filter', 'function');
|
||||||
|
}
|
||||||
|
|
||||||
this.handleCollect = this.handleCollect.bind(this);
|
this.handleCollect = this.handleCollect.bind(this);
|
||||||
this.handleDispose = this.handleDispose.bind(this);
|
this.handleDispose = this.handleDispose.bind(this);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user