mew
This commit is contained in:
parent
1d3f6df896
commit
aca7b630b5
|
@ -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)]
|
||||||
|
|
|
@ -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() {
|
||||||
.deploy_where
|
let sticker_config = config.clone();
|
||||||
.get(&args.deploy_id)
|
|
||||||
.expect("no deploy config with id specified found")
|
match sticker_config
|
||||||
.deploy_to
|
.deploy_where
|
||||||
.as_str()
|
.get(&deploy_id)
|
||||||
{
|
.expect("no deploy config with id specified found")
|
||||||
"discord" => {
|
.deploy_to
|
||||||
println!("deploying {} to discord", &args.deploy_id);
|
.as_str()
|
||||||
deploy_discord(args.deploy_id, config, creds, args.folder).await;
|
{
|
||||||
}
|
"discord" => {
|
||||||
"telegram" => {
|
println!("deploying {} to discord", &deploy_id);
|
||||||
println!("deploying {} to telegram", &args.deploy_id);
|
deploy_discord(
|
||||||
deploy_telegram(args.deploy_id, config, creds, args.folder).await;
|
deploy_id,
|
||||||
}
|
sticker_config,
|
||||||
_ => {
|
creds.clone(),
|
||||||
panic!("deploy_to not set")
|
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 {
|
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
|
||||||
|
|
Loading…
Reference in a new issue