style: replace common Result return type with alias

This commit is contained in:
DarkCat09 2024-11-27 19:09:10 +04:00
parent f4c3a6a569
commit 8573b75047
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82

View file

@ -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())