mirror of
https://github.com/kristoferssolo/tg-relay-rs.git
synced 2026-02-04 06:42:09 +00:00
feat: add commentary
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -2,10 +2,11 @@ use dotenv::dotenv;
|
||||
use std::sync::Arc;
|
||||
use teloxide::{Bot, prelude::Requester, respond, types::Message};
|
||||
use tg_relay_rs::{
|
||||
comments::{Comments, init_global_comments},
|
||||
handlers::{InstagramHandler, SocialHandler},
|
||||
telemetry::setup_logger,
|
||||
};
|
||||
use tracing::{error, info};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> color_eyre::Result<()> {
|
||||
@@ -13,6 +14,16 @@ async fn main() -> color_eyre::Result<()> {
|
||||
color_eyre::install().expect("color-eyre install");
|
||||
setup_logger();
|
||||
|
||||
let comments = Comments::load_from_file("comments.txt")
|
||||
.await
|
||||
.map_err(|e| {
|
||||
warn!("failed to laod comments.txt: {}; using dummy comments", e);
|
||||
e
|
||||
})
|
||||
.unwrap_or_else(|_| Comments::dummy());
|
||||
|
||||
init_global_comments(comments).expect("failed to initialize global comments");
|
||||
|
||||
let bot = Bot::from_env();
|
||||
info!("bot starting");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user