From aca7b630b5a53c1c55d347286c3a28412caa42d5 Mon Sep 17 00:00:00 2001 From: ChaotiCryptidz Date: Mon, 22 Aug 2022 21:46:08 +0100 Subject: [PATCH] mew --- src/args.rs | 2 +- src/cmd_deploy.rs | 50 ++++++++++++++++++++++++++++-------------- src/deploy_telegram.rs | 1 - 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/args.rs b/src/args.rs index e5a6fd1..8a20586 100644 --- a/src/args.rs +++ b/src/args.rs @@ -17,7 +17,7 @@ pub enum Commands { #[derive(Debug, Args)] pub struct DeployArgs { pub folder: String, - pub deploy_id: String, + pub deploy_ids: Vec, } #[derive(Debug, Args)] diff --git a/src/cmd_deploy.rs b/src/cmd_deploy.rs index 30b601c..128f95b 100644 --- a/src/cmd_deploy.rs +++ b/src/cmd_deploy.rs @@ -18,23 +18,39 @@ pub async fn deploy(args: crate::args::DeployArgs) { serde_yaml::from_reader(config_file).expect("could not parse stickers.yml"); let creds: Creds = serde_yaml::from_reader(creds_file).expect("could not parse creds.yml"); - match config - .deploy_where - .get(&args.deploy_id) - .expect("no deploy config with id specified found") - .deploy_to - .as_str() - { - "discord" => { - println!("deploying {} to discord", &args.deploy_id); - deploy_discord(args.deploy_id, config, creds, args.folder).await; - } - "telegram" => { - println!("deploying {} to telegram", &args.deploy_id); - deploy_telegram(args.deploy_id, config, creds, args.folder).await; - } - _ => { - panic!("deploy_to not set") + for deploy_id in args.deploy_ids.into_iter() { + let sticker_config = config.clone(); + + match sticker_config + .deploy_where + .get(&deploy_id) + .expect("no deploy config with id specified found") + .deploy_to + .as_str() + { + "discord" => { + println!("deploying {} to discord", &deploy_id); + deploy_discord( + deploy_id, + sticker_config, + creds.clone(), + args.folder.clone(), + ) + .await; + } + "telegram" => { + println!("deploying {} to telegram", &deploy_id); + deploy_telegram( + deploy_id, + sticker_config, + creds.clone(), + args.folder.clone(), + ) + .await; + } + _ => { + panic!("deploy_to not set") + } } } } diff --git a/src/deploy_telegram.rs b/src/deploy_telegram.rs index 3a4e718..906ced1 100644 --- a/src/deploy_telegram.rs +++ b/src/deploy_telegram.rs @@ -105,7 +105,6 @@ pub async fn deploy_telegram( if pack_contents.len() >= max - 1 { panic!("too many stickers in pack"); } - println!("{}", pack_contents.len()); let tg_bot = TelegramAPI::new(creds.telegram_bot_token); let tg_sticker_set = tg_bot