mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
feat: Intents bitfield (#3844)
* feat: Intents bitfield * suggestion: properly construct Intents.ALL * fix: actually document the ws option * suggestion: remove disabledEvents in favor of intents * suggestion: remove obsolete check, validate falsy values Co-Authored-By: SpaceEEC <spaceeec@yahoo.com> * fix: GUILD_BANS flag * fix: exception for intents check in ws options Co-Authored-By: SpaceEEC <spaceeec@yahoo.com> * docs: IntentsResolvable Co-Authored-By: SpaceEEC <spaceeec@yahoo.com> * Update Client.js Co-authored-by: SpaceEEC <spaceeec@yahoo.com> Co-authored-by: Crawl <icrawltogo@gmail.com>
This commit is contained in:
@@ -17,6 +17,7 @@ const Webhook = require('../structures/Webhook');
|
||||
const Collection = require('../util/Collection');
|
||||
const { Events, browser, DefaultOptions } = require('../util/Constants');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
const Intents = require('../util/Intents');
|
||||
const Permissions = require('../util/Permissions');
|
||||
const Structures = require('../util/Structures');
|
||||
|
||||
@@ -381,6 +382,9 @@ class Client extends BaseClient {
|
||||
* @private
|
||||
*/
|
||||
_validateOptions(options = this.options) {
|
||||
if (typeof options.ws.intents !== 'undefined') {
|
||||
options.ws.intents = Intents.resolve(options.ws.intents);
|
||||
}
|
||||
if (typeof options.shardCount !== 'number' || isNaN(options.shardCount) || options.shardCount < 1) {
|
||||
throw new TypeError('CLIENT_INVALID_OPTION', 'shardCount', 'a number greater than or equal to 1');
|
||||
}
|
||||
@@ -415,9 +419,6 @@ class Client extends BaseClient {
|
||||
if (typeof options.restSweepInterval !== 'number' || isNaN(options.restSweepInterval)) {
|
||||
throw new TypeError('CLIENT_INVALID_OPTION', 'restSweepInterval', 'a number');
|
||||
}
|
||||
if (!Array.isArray(options.disabledEvents)) {
|
||||
throw new TypeError('CLIENT_INVALID_OPTION', 'disabledEvents', 'an Array');
|
||||
}
|
||||
if (typeof options.retryLimit !== 'number' || isNaN(options.retryLimit)) {
|
||||
throw new TypeError('CLIENT_INVALID_OPTION', 'retryLimit', 'a number');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user