Add sendMessageRequestResponse command

This commit is contained in:
AsamK 2024-02-18 20:37:20 +01:00
parent 2c0ad7feb7
commit d84362eb0f
11 changed files with 210 additions and 0 deletions

View file

@ -277,6 +277,14 @@ pub enum CliCommands {
#[arg(short = 's', long)]
stop: bool,
},
SendMessageRequestResponse {
recipient: Vec<String>,
#[arg(short = 'g', long = "group-id")]
group_id: Vec<String>,
r#type: MessageRequestResponseType,
},
SetPin {
pin: String,
},
@ -447,3 +455,10 @@ pub enum GroupPermission {
EveryMember,
OnlyAdmins,
}
#[derive(ValueEnum, Clone, Debug)]
#[value(rename_all = "kebab-case")]
pub enum MessageRequestResponseType {
Accept,
Delete,
}

View file

@ -247,6 +247,15 @@ pub trait Rpc {
stop: bool,
) -> Result<Value, ErrorObjectOwned>;
#[method(name = "sendMessageRequestResponse", param_kind = map)]
fn send_message_request_response(
&self,
account: Option<String>,
recipients: Vec<String>,
#[allow(non_snake_case)] groupIds: Vec<String>,
r#type: String,
) -> Result<Value, ErrorObjectOwned>;
#[method(name = "setPin", param_kind = map)]
fn set_pin(&self, account: Option<String>, pin: String) -> Result<Value, ErrorObjectOwned>;

View file

@ -437,6 +437,23 @@ async fn handle_command(
.start_change_number(cli.account, number, voice, captcha)
.await
}
CliCommands::SendMessageRequestResponse {
recipient,
group_id,
r#type,
} => {
client
.send_message_request_response(
cli.account,
recipient,
group_id,
match r#type {
cli::MessageRequestResponseType::Accept => "accept".to_owned(),
cli::MessageRequestResponseType::Delete => "delete".to_owned(),
},
)
.await
}
}
}