mirror of
https://github.com/danbulant/discord.js
synced 2026-05-26 13:32:04 +00:00
Add disabledEvents option to Client (#784)
This commit is contained in:
parent
da5183a5d5
commit
4653f88555
2 changed files with 6 additions and 0 deletions
|
|
@ -84,6 +84,8 @@ class WebSocketPacketManager {
|
|||
|
||||
this.setSequence(packet.s);
|
||||
|
||||
if (this.ws.client.options.disabledEvents.includes(packet.t)) return false;
|
||||
|
||||
if (this.ws.status !== Constants.Status.READY) {
|
||||
if (BeforeReadyWhitelist.indexOf(packet.t) === -1) {
|
||||
this.queue.push(packet);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ exports.Package = require('../../package.json');
|
|||
* @property {boolean} [disableEveryone=false] Default value for MessageOptions.disableEveryone
|
||||
* @property {number} [restWsBridgeTimeout=5000] Maximum time permitted between REST responses and their
|
||||
* corresponding websocket events
|
||||
* @property {string[]} [disabledEvents] An array of disabled websocket events. Events in this array will not be
|
||||
* processed. Disabling useless events such as 'TYPING_START' can result in significant performance increases on
|
||||
* large-scale bots.
|
||||
* @property {WebsocketOptions} [ws] Options for the websocket
|
||||
*/
|
||||
exports.DefaultOptions = {
|
||||
|
|
@ -29,6 +32,7 @@ exports.DefaultOptions = {
|
|||
fetchAllMembers: false,
|
||||
disableEveryone: false,
|
||||
restWsBridgeTimeout: 5000,
|
||||
disabledEvents: [],
|
||||
|
||||
/**
|
||||
* Websocket options. These are left as snake_case to match the API.
|
||||
|
|
|
|||
Loading…
Reference in a new issue