feat(CaptchaHandler): Must not use due to safety concerns

This commit is contained in:
March 7th
2022-11-04 18:40:19 +07:00
parent 9616ef19a7
commit b3eedc34be
9 changed files with 112 additions and 12 deletions

33
src/rest/CaptchaSolver.js Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
module.exports = class CaptchaSolver {
constructor(service, key) {
this.service = '';
this.solver = undefined;
this._setup(service, key);
}
_setup(service, key) {
switch (service) {
case '2captcha': {
if (!key || typeof key !== 'string') throw new Error('2captcha key is not provided');
try {
const lib = require('2captcha');
this.service = '2captcha';
this.solver = new lib.Solver(key);
this.solve = siteKey =>
new Promise((resolve, reject) => {
this.solver
.hcaptcha(siteKey, 'discord.com')
.then(res => {
resolve(res.data);
})
.catch(reject);
});
break;
} catch (e) {
throw new Error('2captcha module not found, please install it with `npm i 2captcha`');
}
}
}
}
solve() {}
};