diff --git a/src/main.rs b/src/main.rs index 70f2380..003ef54 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,8 @@ const POLL_TIMEOUT: &str = "300"; /// Update types to receive (filtered out on tg backend) const POLL_TYPES: &str = r#"["message"]"#; +type BotFnResult = Result<(), reqwest::Error>; + #[tokio::main] async fn main() -> std::io::Result<()> { let cfg = { @@ -63,7 +65,7 @@ async fn main() -> std::io::Result<()> { Ok(()) } -async fn init_cmds(client: &Client, token: &str) -> Result<(), reqwest::Error> { +async fn init_cmds(client: &Client, token: &str) -> BotFnResult { client .post(format!("{BOT_URL}{token}/setMyCommands")) .form(&[( @@ -83,7 +85,7 @@ async fn init_cmds(client: &Client, token: &str) -> Result<(), reqwest::Error> { Ok(()) } -async fn handler(cfg: &Config, s: &mut State) -> Result<(), reqwest::Error> { +async fn handler(cfg: &Config, s: &mut State) -> BotFnResult { let mut updates = cfg .client .get((*cfg.upd_url).clone()) @@ -148,7 +150,7 @@ async fn handler(cfg: &Config, s: &mut State) -> Result<(), reqwest::Error> { Ok(()) } -async fn send_comic(cfg: Config, ctx: SenderCtx) -> Result<(), reqwest::Error> { +async fn send_comic(cfg: Config, ctx: SenderCtx) -> BotFnResult { let info = cfg .client .get(ctx.url.clone())