614456ed35 2025-02-22 1: //! This is telegram bot to fetch RSS/ATOM feeds and post results on public
614456ed35 2025-02-22 2: //! channels
614456ed35 2025-02-22 3:
614456ed35 2025-02-22 4: #![warn(missing_docs)]
614456ed35 2025-02-22 5:
614456ed35 2025-02-22 6: mod command;
614456ed35 2025-02-22 7: mod core;
0340541002 2025-04-24 8: mod sql;
9c4f09193a 2026-01-09 9: mod tg_bot;
bb89b6fab8 2025-06-15 10:
dc7c43b010 2026-01-01 11: use async_compat::Compat;
44575a91d3 2025-07-09 12: use stacked_errors::{
44575a91d3 2025-07-09 13: Result,
44575a91d3 2025-07-09 14: StackableErr,
44575a91d3 2025-07-09 15: };
bb89b6fab8 2025-06-15 16: use tgbot::handler::LongPoll;
bb89b6fab8 2025-06-15 17:
dc7c43b010 2026-01-01 18: fn main () -> Result<()> {
7393d62235 2026-01-07 19: smol::block_on(Compat::new(async {
dc7c43b010 2026-01-01 20: async_main().await.unwrap();
dc7c43b010 2026-01-01 21: }));
dc7c43b010 2026-01-01 22:
dc7c43b010 2026-01-01 23: Ok(())
dc7c43b010 2026-01-01 24: }
dc7c43b010 2026-01-01 25:
dc7c43b010 2026-01-01 26: async fn async_main () -> Result<()> {
e624ef9d66 2025-04-20 27: let settings = config::Config::builder()
42b29b744b 2026-01-01 28: .set_default("api_gateway", "https://api.telegram.org").stack()?
e624ef9d66 2025-04-20 29: .add_source(config::File::with_name("rsstg"))
44575a91d3 2025-07-09 30: .build()
44575a91d3 2025-07-09 31: .stack()?;
e624ef9d66 2025-04-20 32:
44575a91d3 2025-07-09 33: let core = core::Core::new(settings).await.stack()?;
e624ef9d66 2025-04-20 34:
9c4f09193a 2026-01-09 35: LongPoll::new(core.tg.client.clone(), core).run().await;
61df933942 2020-11-18 36:
61df933942 2020-11-18 37: Ok(())
61df933942 2020-11-18 38: }