CaptchaSolver
typedef · Source
Solves an hCaptcha challenge returned by Discord and returns a verified token.
When a request hits a captcha challenge, the REST handler calls this function with the challenge payload and the user agent that Discord observed, then replays the original request with the returned token as the X-Captcha-Key header (and Discord's captcha_rqtoken as X-Captcha-Rqtoken).
Common implementations delegate to a commercial solving service (for example CapSolver or 2captcha). The function must resolve to a non-empty string token; any other value rejects the request with CAPTCHA_SOLVER_INVALID_RESPONSE.
Solver failures propagate unchanged so callers can distinguish them from HTTP failures. Type: functionParameters
| Name | Type | Description |
|---|---|---|
captcha | Captcha | The challenge payload, including captcha_sitekey, captcha_rqdata, and captcha_service |
UserAgent | string | The user agent Discord observed for the request |
Returns: Promise<string> — The solved hCaptcha token