7 Commits
Author SHA1 Message Date
phoenix ff79d38305 Adding license (#11)
sender Build / Check (push) Successful in 1m35s
sender Build / Rustfmt (push) Successful in 57s
sender Build / Test Suite (push) Successful in 2m39s
sender Build / Clippy (push) Successful in 3m2s
sender Build / build (push) Successful in 4m55s
Reviewed-on: #11
2026-07-14 11:33:30 -04:00
phoenix a42b5aa460 Dependency name change (#10)
sender Build / Check (push) Successful in 56s
sender Build / Test Suite (push) Successful in 1m0s
sender Build / Rustfmt (push) Successful in 1m4s
sender Build / Clippy (push) Successful in 1m37s
sender Build / build (push) Successful in 2m31s
Reviewed-on: #10
2026-07-13 15:44:07 -04:00
phoenix ea31581464 Update rust (#9)
sender pr / Rustfmt (pull_request) Successful in 45s
sender pr / Clippy (pull_request) Successful in 1m13s
sender pr / Check (pull_request) Successful in 2m34s
sender Build / Check (push) Successful in 1m24s
sender Build / build (push) Successful in 4m18s
sender Build / Rustfmt (push) Successful in 48s
sender Build / Test Suite (push) Successful in 1m20s
sender Build / Clippy (push) Successful in 1m53s
Reviewed-on: #9
2026-07-10 17:21:37 -04:00
phoenix c62fddf44e Update rust (#8)
sender pr / Check (pull_request) Failing after 13s
sender pr / Rustfmt (pull_request) Successful in 1m10s
sender pr / Clippy (pull_request) Successful in 3m42s
sender Build / Check (push) Successful in 1m39s
sender Build / Rustfmt (push) Successful in 1m19s
sender Build / Test Suite (push) Successful in 2m3s
sender Build / Clippy (push) Successful in 2m10s
sender Build / build (push) Successful in 2m53s
Reviewed-on: #8
2026-07-06 23:15:25 -04:00
phoenix b5a01cbdc2 Update (#7)
sender Build / build (push) Successful in 1m40s
sender Build / Check (push) Successful in 1m32s
sender Build / Rustfmt (push) Successful in 52s
sender Build / Clippy (push) Successful in 2m1s
sender Build / Test Suite (push) Successful in 2m11s
sender pr / Check (pull_request) Successful in 1m6s
sender pr / Rustfmt (pull_request) Successful in 30s
sender pr / Clippy (pull_request) Successful in 1m35s
Reviewed-on: #7
2026-06-14 18:30:25 -04:00
phoenix 416ff1ef89 Update dependency name (#6)
sender Build / Check (push) Successful in 1m4s
sender Build / Rustfmt (push) Successful in 47s
sender Build / Clippy (push) Successful in 1m19s
sender Build / build (push) Successful in 1m34s
sender Build / Test Suite (push) Successful in 2m42s
Reviewed-on: #6
2026-06-13 13:21:10 -04:00
phoenix 6396bc861b Update dependencies (#5)
sender Build / Check (push) Successful in 1m27s
sender Build / Rustfmt (push) Successful in 36s
sender Build / Test Suite (push) Successful in 1m15s
sender Build / Clippy (push) Successful in 42s
sender Build / build (push) Successful in 1m40s
sender Build / Check (pull_request) Successful in 1m3s
sender Build / Rustfmt (pull_request) Successful in 54s
sender Build / Test Suite (pull_request) Successful in 1m43s
sender Build / Clippy (pull_request) Successful in 1m37s
sender Build / build (pull_request) Successful in 3m11s
Reviewed-on: #5
2026-06-07 16:02:46 -04:00
9 changed files with 861 additions and 726 deletions
+65
View File
@@ -0,0 +1,65 @@
name: sender pr
on:
pull_request:
branches:
- main
jobs:
check:
name: Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/deploy_key
cargo check
fmt:
name: Rustfmt
runs-on: ubuntu-24.04
needs: setup_ssh
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: rustup component add rustfmt
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/deploy_key
cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-24.04
needs: setup_ssh
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: rustup component add clippy
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/deploy_key
cargo clippy -- -D warnings
+16 -14
View File
@@ -3,20 +3,18 @@ name: sender Build
on:
push:
branches:
- v0.1.x
pull_request:
branches:
- v0.1.x
- main
jobs:
check:
name: Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.95
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/deploy_key
@@ -31,10 +29,11 @@ jobs:
runs-on: ubuntu-24.04
needs: setup_ssh
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.95
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
env:
AUTH_SID: 'n9c43yr3f2c4743f7y4329dnq238f7'
AUTH_TOKEN: '9nmc4820qf4cor838r4fy3o84rfy348fyr'
@@ -56,10 +55,11 @@ jobs:
runs-on: ubuntu-24.04
needs: setup_ssh
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.95
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: rustup component add rustfmt
- run: |
mkdir -p ~/.ssh
@@ -75,10 +75,11 @@ jobs:
runs-on: ubuntu-24.04
needs: setup_ssh
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.95
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: rustup component add clippy
- run: |
mkdir -p ~/.ssh
@@ -94,10 +95,11 @@ jobs:
runs-on: ubuntu-24.04
needs: setup_ssh
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.95
toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/deploy_key
Generated
+724 -684
View File
File diff suppressed because it is too large Load Diff
+8 -10
View File
@@ -1,17 +1,15 @@
[package]
name = "sender"
version = "0.1.0"
version = "0.1.6"
edition = "2024"
rust-version = "1.95"
license = "MIT"
description = "CLI tool to send text messages"
rust-version = "1.97"
[dependencies]
# uuid = { version = "1.23.1", features = ["v4", "serde"] }
# serde = { version = "1.0.228", features = ["derive"] }
serde_json = { version = "1.0.149" }
tokio = { version = "1.52.2", features = ["full"] }
futures = { version = "0.3.32" }
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender-models.git", tag = "v0.2.5-v0.3.0-migrate-38dbcb09f7-111" }
swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.3.1-main-ab01daafea-871" }
serde_json = { version = "1.0.150" }
tokio = { version = "1.52.3", features = ["full"] }
schedtxt_models = { git = "ssh://git@git.kundeng.us/phoenix/schedtxt_models.git", tag = "v0.5.3", features = ["config", "contact", "envy", "message"] }
swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.3" }
[dev-dependencies]
async-std = { version = "1.13.2" }
+22
View File
@@ -0,0 +1,22 @@
Copyright (c) 2026 Kun Deng.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
+2
View File
@@ -0,0 +1,2 @@
# sender
A CLI tool that can send text messages.
+7 -7
View File
@@ -20,14 +20,14 @@ fn path_exists(path: &str) -> bool {
file.exists()
}
pub async fn parse_config() -> (textsender_models::config::auxiliary::TwilioConfig, bool) {
let mut config = textsender_models::config::auxiliary::TwilioConfig {
pub fn parse_config() -> (schedtxt_models::config::auxiliary::TwilioConfig, bool) {
let mut config = schedtxt_models::config::auxiliary::TwilioConfig {
..Default::default()
};
let auth_sid_var = textsender_models::envy::environment::get_env("AUTH_SID").await;
let auth_token_var = textsender_models::envy::environment::get_env("AUTH_TOKEN").await;
let phone_number_var = textsender_models::envy::environment::get_env("PHONE_NUMBER").await;
let service_sid_var = textsender_models::envy::environment::get_env("SERVICE_SID").await;
let auth_sid_var = schedtxt_models::envy::environment::get_env("AUTH_SID");
let auth_token_var = schedtxt_models::envy::environment::get_env("AUTH_TOKEN");
let phone_number_var = schedtxt_models::envy::environment::get_env("PHONE_NUMBER");
let service_sid_var = schedtxt_models::envy::environment::get_env("SERVICE_SID");
config.account_sid = auth_sid_var.value;
config.auth_token = auth_token_var.value;
config.phone_number = phone_number_var.value;
@@ -46,7 +46,7 @@ pub async fn parse_config() -> (textsender_models::config::auxiliary::TwilioConf
mod tests {
#[test]
fn test_parse_config() {
let (config, success) = async_std::task::block_on(super::parse_config());
let (config, success) = super::parse_config();
assert!(success, "Config was not parsed");
assert_eq!(
false,
+1 -1
View File
@@ -17,7 +17,7 @@ async fn main() {
println!("Message path: {m_path:?}");
println!("Phone Number path: {n_path:?}");
let (config, success) = config::parse_config().await;
let (config, success) = config::parse_config();
if !success {
eprintln!("Error parsing config");
} else {
+16 -10
View File
@@ -1,23 +1,31 @@
use textsender_models::config::auxiliary::TwilioConfig;
use textsender_models::contact::Contact;
use textsender_models::message::Message;
use schedtxt_models::config::auxiliary::TwilioConfig;
use schedtxt_models::contact::Contact;
use schedtxt_models::message::Message;
pub async fn send_messages(
config: &TwilioConfig,
contacts: &Vec<Contact>,
contacts: &[Contact],
message: &Message,
second_interval: u64,
) {
let long_sleep_limit: i64 = 5;
let mut count: i64 = 0;
for contact in contacts.iter() {
for (text_count, contact) in (0_i64..).zip(contacts.iter()) {
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 {
let mut sendmsg = swoosh::SendMsg::default();
sendmsg.load_config(
&config.auth_token,
&config.phone_number,
&config.service_sid,
&config.account_sid,
);
sendmsg.load_recipient(&contact.phone_number);
sendmsg.load_message(&message.content);
match sendmsg.send_message(&param).await {
Ok(response) => {
println!("Raw response: {response:?}");
let val = swoosh::twilio::api::response_to_json(response).await;
@@ -28,7 +36,7 @@ pub async fn send_messages(
}
}
if count % long_sleep_limit == 0 {
if text_count % long_sleep_limit == 0 {
// Sleep for X seconds
let wait_time = second_interval;
std::thread::sleep(std::time::Duration::from_secs(wait_time));
@@ -36,8 +44,6 @@ pub async fn send_messages(
// Sleep for a second
std::thread::sleep(std::time::Duration::from_secs(1));
}
count += 1;
}
}