Hex Artifact Content
Logged in as anonymous

Artifact d4786b06c7bdccc0313cedad1b6fedf7fbc51de4f9744d1cf6b2410e08f33aaa:


0000: 2f 2f 21 20 54 68 69 73 20 69 73 20 74 65 6c 65  //! This is tele
0010: 67 72 61 6d 20 62 6f 74 20 74 6f 20 66 65 74 63  gram bot to fetc
0020: 68 20 52 53 53 2f 41 54 4f 4d 20 66 65 65 64 73  h RSS/ATOM feeds
0030: 20 61 6e 64 20 70 6f 73 74 20 72 65 73 75 6c 74   and post result
0040: 73 20 6f 6e 20 70 75 62 6c 69 63 0a 2f 2f 21 20  s on public.//! 
0050: 63 68 61 6e 6e 65 6c 73 0a 0a 23 21 5b 77 61 72  channels..#![war
0060: 6e 28 6d 69 73 73 69 6e 67 5f 64 6f 63 73 29 5d  n(missing_docs)]
0070: 0a 0a 6d 6f 64 20 63 6f 6d 6d 61 6e 64 3b 0a 6d  ..mod command;.m
0080: 6f 64 20 63 6f 72 65 3b 0a 6d 6f 64 20 73 71 6c  od core;.mod sql
0090: 3b 0a 0a 75 73 65 20 61 6e 79 68 6f 77 3a 3a 52  ;..use anyhow::R
00a0: 65 73 75 6c 74 3b 0a 75 73 65 20 74 67 62 6f 74  esult;.use tgbot
00b0: 3a 3a 68 61 6e 64 6c 65 72 3a 3a 4c 6f 6e 67 50  ::handler::LongP
00c0: 6f 6c 6c 3b 0a 0a 23 5b 61 73 79 6e 63 5f 73 74  oll;..#[async_st
00d0: 64 3a 3a 6d 61 69 6e 5d 0a 61 73 79 6e 63 20 66  d::main].async f
00e0: 6e 20 6d 61 69 6e 28 29 20 2d 3e 20 52 65 73 75  n main() -> Resu
00f0: 6c 74 3c 28 29 3e 20 7b 0a 09 6c 65 74 20 73 65  lt<()> {..let se
0100: 74 74 69 6e 67 73 20 3d 20 63 6f 6e 66 69 67 3a  ttings = config:
0110: 3a 43 6f 6e 66 69 67 3a 3a 62 75 69 6c 64 65 72  :Config::builder
0120: 28 29 0a 09 09 2e 61 64 64 5f 73 6f 75 72 63 65  ()....add_source
0130: 28 63 6f 6e 66 69 67 3a 3a 46 69 6c 65 3a 3a 77  (config::File::w
0140: 69 74 68 5f 6e 61 6d 65 28 22 72 73 73 74 67 22  ith_name("rsstg"
0150: 29 29 0a 09 09 2e 62 75 69 6c 64 28 29 3f 3b 0a  ))....build()?;.
0160: 0a 09 6c 65 74 20 63 6f 72 65 20 3d 20 63 6f 72  ..let core = cor
0170: 65 3a 3a 43 6f 72 65 3a 3a 6e 65 77 28 73 65 74  e::Core::new(set
0180: 74 69 6e 67 73 29 2e 61 77 61 69 74 3f 3b 0a 0a  tings).await?;..
0190: 09 4c 6f 6e 67 50 6f 6c 6c 3a 3a 6e 65 77 28 63  .LongPoll::new(c
01a0: 6f 72 65 2e 74 67 2e 63 6c 6f 6e 65 28 29 2c 20  ore.tg.clone(), 
01b0: 63 6f 72 65 29 2e 72 75 6e 28 29 2e 61 77 61 69  core).run().awai
01c0: 74 3b 0a 0a 09 4f 6b 28 28 29 29 0a 7d 0a        t;...Ok(()).}.