refactor: make use of destructuring for Constants (#1942)

This commit is contained in:
SpaceEEC
2017-09-16 20:31:36 +02:00
committed by Crawl
parent 25ece1882b
commit ec4c98704f
66 changed files with 262 additions and 262 deletions

View File

@@ -1,4 +1,5 @@
const Collector = require('./interfaces/Collector');
const { Events } = require('../util/Constants');
/**
* @typedef {CollectorOptions} MessageCollectorOptions
@@ -36,14 +37,14 @@ class MessageCollector extends Collector {
for (const message of messages.values()) this.handleDispose(message);
}).bind(this);
this.client.on('message', this.handleCollect);
this.client.on('messageDelete', this.handleDispose);
this.client.on('messageDeleteBulk', bulkDeleteListener);
this.client.on(Events.MESSAGE_CREATE, this.handleCollect);
this.client.on(Events.MESSAGE_DELETE, this.handleDispose);
this.client.on(Events.MESSAGE_BULK_DELETE, bulkDeleteListener);
this.once('end', () => {
this.client.removeListener('message', this.handleCollect);
this.client.removeListener('messageDelete', this.handleDispose);
this.client.removeListener('messageDeleteBulk', bulkDeleteListener);
this.client.removeListener(Events.MESSAGE_CREATE, this.handleCollect);
this.client.removeListener(Events.MESSAGE_DELETE, this.handleDispose);
this.client.removeListener(Events.MESSAGE_BULK_DELETE, bulkDeleteListener);
});
}