use chrono::{Duration};
use log::{LevelFilter};
use once_cell::sync::Lazy;
use reqwest::Client;
use systemd_journal_logger::{JournalLog};
use crate::bot::Bot;

mod bot;
mod config;
mod lemmy;
mod post_history;
mod fetchers;

pub static HTTP_CLIENT: Lazy<Client> = Lazy::new(|| {
    Client::builder()
        .timeout(Duration::seconds(10).to_std().unwrap())
        .connect_timeout(Duration::seconds(10).to_std().unwrap())
        .build()
        .expect("build client")
});

#[tokio::main]
async fn main() {
    JournalLog::new()
        .expect("Systemd-Logger crate error")
        .install()
        .expect("Systemd-Logger crate error");
    log::set_max_level(LevelFilter::Info);
    let mut bot = Bot::new();
    bot.run().await;
}