1 package org
.asamk
.signal
.commands
;
3 import net
.sourceforge
.argparse4j
.inf
.Namespace
;
4 import net
.sourceforge
.argparse4j
.inf
.Subparser
;
6 import org
.asamk
.signal
.commands
.exceptions
.CommandException
;
7 import org
.asamk
.signal
.commands
.exceptions
.IOErrorException
;
8 import org
.asamk
.signal
.manager
.Manager
;
9 import org
.asamk
.signal
.output
.OutputWriter
;
11 import java
.io
.IOException
;
13 public class SubmitRateLimitChallengeCommand
implements JsonRpcLocalCommand
{
16 public String
getName() {
17 return "submitRateLimitChallenge";
21 public void attachToSubparser(final Subparser subparser
) {
23 "Submit a captcha challenge to lift the rate limit. This command should only be necessary when sending fails with a proof required error.");
24 subparser
.addArgument("--challenge")
26 .help("The challenge token taken from the proof required error.");
27 subparser
.addArgument("--captcha")
29 .help("The captcha token from the solved captcha on the signal website.");
33 public void handleCommand(final Namespace ns
, final Manager m
, OutputWriter outputWriter
) throws CommandException
{
34 final var challenge
= ns
.getString("challenge");
35 final var captcha
= ns
.getString("captcha");
38 m
.submitRateLimitRecaptchaChallenge(challenge
, captcha
);
39 } catch (IOException e
) {
40 throw new IOErrorException("Submit challenge error: " + e
.getMessage(), e
);