Saving changes
sender Build / Rustfmt (pull_request) Successful in 33s
sender Build / build (pull_request) Successful in 48s
sender Build / Check (pull_request) Successful in 28s
sender Build / Test Suite (pull_request) Failing after 39s
sender Build / Clippy (pull_request) Failing after 34s

This commit is contained in:
2026-06-06 16:28:43 -04:00
parent 5d3a501b58
commit faca4ab122
2 changed files with 45 additions and 1 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ pub async fn parse_config() -> (textsender_models::config::auxiliary::TwilioConf
config.phone_number = phone_number_var.value;
config.service_sid = service_sid_var.value;
let success = {
!config.account_sid.is_empty() && !config.auth_token.is_empty() && !config.phone_number.is_empty() && !config.service_sid.is_empty()
!config.account_sid.is_empty()
&& !config.auth_token.is_empty()
&& !config.phone_number.is_empty()
&& !config.service_sid.is_empty()
};
(config, success)
+41
View File
@@ -1 +1,42 @@
use textsender_models::config::auxiliary::TwilioConfig;
use textsender_models::contact::Contact;
use textsender_models::message::Message;
pub async fn send_messages(
config: &TwilioConfig,
contacts: &Vec<Contact>,
message: &Message,
second_interval: u64,
) {
let long_sleep_limit: i64 = 5;
let mut count: i64 = 0;
for contact in contacts {
println!("Sending to: {:?}", contact.phone_number);
let param = swoosh::twilio::types::Parameters {
schedule: false,
schedule_at: None,
};
match swoosh::twilio::api::send_mssage(message, contact, param, config).await {
Ok(response) => {
println!("Raw response: {response:?}");
let val = swoosh::twilio::api::response_to_json(response).await;
println!("Response: {val:?}");
}
Err(err) => {
eprintln!("Error: {err:?}");
}
}
if count % long_sleep_limit == 0 {
// Sleep for X seconds
let wait_time = second_interval;
std::thread::sleep(std::time::Duration::from_secs(wait_time));
} else {
// Sleep for a second
std::thread::sleep(std::time::Duration::from_secs(1));
}
count += 1;
}
}