1
0
Fork 0
This commit is contained in:
ChaotiCryptidz 2022-08-22 21:46:08 +01:00
parent 1d3f6df896
commit aca7b630b5
No known key found for this signature in database
3 changed files with 34 additions and 19 deletions

View file

@ -17,7 +17,7 @@ pub enum Commands {
#[derive(Debug, Args)] #[derive(Debug, Args)]
pub struct DeployArgs { pub struct DeployArgs {
pub folder: String, pub folder: String,
pub deploy_id: String, pub deploy_ids: Vec<String>,
} }
#[derive(Debug, Args)] #[derive(Debug, Args)]

View file

@ -18,23 +18,39 @@ pub async fn deploy(args: crate::args::DeployArgs) {
serde_yaml::from_reader(config_file).expect("could not parse stickers.yml"); 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"); let creds: Creds = serde_yaml::from_reader(creds_file).expect("could not parse creds.yml");
match config for deploy_id in args.deploy_ids.into_iter() {
let sticker_config = config.clone();
match sticker_config
.deploy_where .deploy_where
.get(&args.deploy_id) .get(&deploy_id)
.expect("no deploy config with id specified found") .expect("no deploy config with id specified found")
.deploy_to .deploy_to
.as_str() .as_str()
{ {
"discord" => { "discord" => {
println!("deploying {} to discord", &args.deploy_id); println!("deploying {} to discord", &deploy_id);
deploy_discord(args.deploy_id, config, creds, args.folder).await; deploy_discord(
deploy_id,
sticker_config,
creds.clone(),
args.folder.clone(),
)
.await;
} }
"telegram" => { "telegram" => {
println!("deploying {} to telegram", &args.deploy_id); println!("deploying {} to telegram", &deploy_id);
deploy_telegram(args.deploy_id, config, creds, args.folder).await; deploy_telegram(
deploy_id,
sticker_config,
creds.clone(),
args.folder.clone(),
)
.await;
} }
_ => { _ => {
panic!("deploy_to not set") panic!("deploy_to not set")
} }
} }
} }
}

View file

@ -105,7 +105,6 @@ pub async fn deploy_telegram(
if pack_contents.len() >= max - 1 { if pack_contents.len() >= max - 1 {
panic!("too many stickers in pack"); panic!("too many stickers in pack");
} }
println!("{}", pack_contents.len());
let tg_bot = TelegramAPI::new(creds.telegram_bot_token); let tg_bot = TelegramAPI::new(creds.telegram_bot_token);
let tg_sticker_set = tg_bot let tg_sticker_set = tg_bot