chore: clean code
This commit is contained in:
parent
99882764ec
commit
ac63d40cb3
@ -32,7 +32,7 @@ const StickerPack = require('../structures/StickerPack');
|
|||||||
const VoiceRegion = require('../structures/VoiceRegion');
|
const VoiceRegion = require('../structures/VoiceRegion');
|
||||||
const Webhook = require('../structures/Webhook');
|
const Webhook = require('../structures/Webhook');
|
||||||
const Widget = require('../structures/Widget');
|
const Widget = require('../structures/Widget');
|
||||||
const { Events, InviteScopes, Status } = require('../util/Constants');
|
const { Events, InviteScopes, Status, captchaServices } = require('../util/Constants');
|
||||||
const DataResolver = require('../util/DataResolver');
|
const DataResolver = require('../util/DataResolver');
|
||||||
const Intents = require('../util/Intents');
|
const Intents = require('../util/Intents');
|
||||||
const Options = require('../util/Options');
|
const Options = require('../util/Options');
|
||||||
@ -992,7 +992,6 @@ class Client extends BaseClient {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_validateOptions(options = this.options) {
|
_validateOptions(options = this.options) {
|
||||||
const captchaService = ['2captcha'];
|
|
||||||
if (typeof options.intents === 'undefined') {
|
if (typeof options.intents === 'undefined') {
|
||||||
throw new TypeError('CLIENT_MISSING_INTENTS');
|
throw new TypeError('CLIENT_MISSING_INTENTS');
|
||||||
} else {
|
} else {
|
||||||
@ -1010,10 +1009,10 @@ class Client extends BaseClient {
|
|||||||
if (options && typeof options.autoRedeemNitro !== 'boolean') {
|
if (options && typeof options.autoRedeemNitro !== 'boolean') {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'autoRedeemNitro', 'a boolean');
|
throw new TypeError('CLIENT_INVALID_OPTION', 'autoRedeemNitro', 'a boolean');
|
||||||
}
|
}
|
||||||
if (options && options.captchaService && !captchaService.includes(options.captchaService)) {
|
if (options && options.captchaService && !captchaServices.includes(options.captchaService)) {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'captchaService', captchaService.join(', '));
|
throw new TypeError('CLIENT_INVALID_OPTION', 'captchaService', captchaServices.join(', '));
|
||||||
}
|
}
|
||||||
if (options && captchaService.includes(options.captchaService) && typeof options.captchaKey !== 'string') {
|
if (options && captchaServices.includes(options.captchaService) && typeof options.captchaKey !== 'string') {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'captchaKey', 'a string');
|
throw new TypeError('CLIENT_INVALID_OPTION', 'captchaKey', 'a string');
|
||||||
}
|
}
|
||||||
if (options && typeof options.DMSync !== 'boolean') {
|
if (options && typeof options.DMSync !== 'boolean') {
|
||||||
@ -1025,6 +1024,9 @@ class Client extends BaseClient {
|
|||||||
if (options && options.password && typeof options.password !== 'string') {
|
if (options && options.password && typeof options.password !== 'string') {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'password', 'a string');
|
throw new TypeError('CLIENT_INVALID_OPTION', 'password', 'a string');
|
||||||
}
|
}
|
||||||
|
if (options && options.interactionTimeout && typeof options.interactionTimeout !== 'number') {
|
||||||
|
throw new TypeError('CLIENT_INVALID_OPTION', 'interactionTimeout', 'a number');
|
||||||
|
}
|
||||||
if (options && typeof options.proxy !== 'string') {
|
if (options && typeof options.proxy !== 'string') {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'proxy', 'a string');
|
throw new TypeError('CLIENT_INVALID_OPTION', 'proxy', 'a string');
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ class MessageButton extends BaseMessageComponent {
|
|||||||
message.client.removeListener('interactionResponse', handler);
|
message.client.removeListener('interactionResponse', handler);
|
||||||
message.client.decrementMaxListeners();
|
message.client.decrementMaxListeners();
|
||||||
reject(new Error('INTERACTION_TIMEOUT'));
|
reject(new Error('INTERACTION_TIMEOUT'));
|
||||||
}, 15_000).unref();
|
}, message.client.options.interactionTimeout).unref();
|
||||||
message.client.incrementMaxListeners();
|
message.client.incrementMaxListeners();
|
||||||
message.client.on('interactionResponse', handler);
|
message.client.on('interactionResponse', handler);
|
||||||
});
|
});
|
||||||
|
@ -396,7 +396,7 @@ class MessageSelectMenu extends BaseMessageComponent {
|
|||||||
message.client.removeListener('interactionResponse', handler);
|
message.client.removeListener('interactionResponse', handler);
|
||||||
message.client.decrementMaxListeners();
|
message.client.decrementMaxListeners();
|
||||||
reject(new Error('INTERACTION_TIMEOUT'));
|
reject(new Error('INTERACTION_TIMEOUT'));
|
||||||
}, 15_000).unref();
|
}, message.client.options.interactionTimeout).unref();
|
||||||
message.client.incrementMaxListeners();
|
message.client.incrementMaxListeners();
|
||||||
message.client.on('interactionResponse', handler);
|
message.client.on('interactionResponse', handler);
|
||||||
});
|
});
|
||||||
|
@ -9,15 +9,15 @@ const listUserAgent = [
|
|||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
||||||
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
||||||
'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
||||||
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0',
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13.0; rv:106.0) Gecko/20100101 Firefox/106.0',
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13.0; rv:107.0) Gecko/20100101 Firefox/107.0',
|
||||||
'Mozilla/5.0 (X11; Linux i686; rv:106.0) Gecko/20100101 Firefox/106.0',
|
'Mozilla/5.0 (X11; Linux i686; rv:107.0) Gecko/20100101 Firefox/107.0',
|
||||||
'Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0',
|
'Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0',
|
||||||
'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:106.0) Gecko/20100101 Firefox/106.0',
|
'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:107.0) Gecko/20100101 Firefox/107.0',
|
||||||
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0',
|
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0',
|
||||||
'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0',
|
'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0',
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13.0; rv:102.0) Gecko/20100101 Firefox/102.0',
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13.0; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||||
'Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Firefox/102.0',
|
'Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||||
@ -25,11 +25,18 @@ const listUserAgent = [
|
|||||||
'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:102.0) Gecko/20100101 Firefox/102.0',
|
'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||||
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||||
'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15',
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15',
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52',
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35',
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API captcha solver
|
||||||
|
* * `2captcha` - 2captcha.com
|
||||||
|
* @typedef {string[]} captchaServices
|
||||||
|
*/
|
||||||
|
exports.captchaServices = ['2captcha'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically scan and delete direct messages you receive that contain explicit media content.
|
* Automatically scan and delete direct messages you receive that contain explicit media content.
|
||||||
* * `NOT_SCAN` - Direct messages will not be scanned for explicit content.
|
* * `NOT_SCAN` - Direct messages will not be scanned for explicit content.
|
||||||
|
Loading…
Reference in New Issue
Block a user