feat: remove nopecha
This commit is contained in:
@@ -70,6 +70,10 @@ class APIRequest {
|
||||
if (this.options.auth !== false) headers.Authorization = this.rest.getAuth();
|
||||
if (this.options.reason) headers['X-Audit-Log-Reason'] = encodeURIComponent(this.options.reason);
|
||||
if (this.options.headers) headers = Object.assign(headers, this.options.headers);
|
||||
// Delete all headers if undefined
|
||||
for (const [key, value] of Object.entries(headers)) {
|
||||
if (value === undefined) delete headers[key];
|
||||
}
|
||||
if (this.options.webhook === true) {
|
||||
headers = {
|
||||
'User-Agent': this.client.options.http.headers['User-Agent'],
|
||||
|
@@ -91,33 +91,6 @@ module.exports = class CaptchaSolver {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'nopecha': {
|
||||
if (!key || typeof key !== 'string') throw new Error('nopecha key is not provided');
|
||||
try {
|
||||
const { Configuration, NopeCHAApi } = require('nopecha');
|
||||
this.service = 'nopecha';
|
||||
this.key = key;
|
||||
const configuration = new Configuration({
|
||||
apiKey: key,
|
||||
});
|
||||
this.solver = new NopeCHAApi(configuration);
|
||||
this.solve = (data, userAgent) =>
|
||||
new Promise((resolve, reject) => {
|
||||
if (data.captcha_rqdata) reject(new Error('nopecha does not support invisible captcha'));
|
||||
this.solver
|
||||
.solveToken({
|
||||
type: 'hcaptcha',
|
||||
sitekey: data.captcha_sitekey,
|
||||
url: 'https://discord.com/channels/@me',
|
||||
useragent: userAgent,
|
||||
})
|
||||
.then(console.log);
|
||||
});
|
||||
break;
|
||||
} catch (e) {
|
||||
throw this._missingModule('nopecha');
|
||||
}
|
||||
}
|
||||
default: {
|
||||
this.solve = this.defaultCaptchaSolver;
|
||||
}
|
||||
|
Reference in New Issue
Block a user