feat: custom solve captcha function

This commit is contained in:
March 7th
2023-01-03 13:56:24 +07:00
parent 84e2e23468
commit c9d2d1bd18
7 changed files with 30 additions and 5 deletions

View File

@@ -1,8 +1,9 @@
'use strict';
module.exports = class CaptchaSolver {
constructor(service, key) {
this.service = '';
constructor(service, key, defaultCaptchaSolver) {
this.service = 'custom';
this.solver = undefined;
this.defaultCaptchaSolver = defaultCaptchaSolver;
this._setup(service, key);
}
_missingModule(name) {
@@ -37,6 +38,9 @@ module.exports = class CaptchaSolver {
throw this._missingModule('2captcha');
}
}
default: {
this.solve = this.defaultCaptchaSolver;
}
}
}
solve() {}

View File

@@ -28,7 +28,11 @@ class RESTManager {
}
setup() {
this.captchaService = new CaptchaSolver(this.client.options.captchaService, this.client.options.captchaKey);
this.captchaService = new CaptchaSolver(
this.client.options.captchaService,
this.client.options.captchaKey,
this.client.options.captchaSolver,
);
}
get api() {