mew
This commit is contained in:
parent
1d3f6df896
commit
aca7b630b5
|
@ -17,7 +17,7 @@ pub enum Commands {
|
|||
#[derive(Debug, Args)]
|
||||
pub struct DeployArgs {
|
||||
pub folder: String,
|
||||
pub deploy_id: String,
|
||||
pub deploy_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Args)]
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue