aob-lemmy-bot/src/main.rs

31 lines
713 B
Rust
Raw Normal View History

2024-05-06 20:53:38 +02:00
use chrono::{Duration};
use log::{LevelFilter};
use once_cell::sync::Lazy;
2023-12-30 01:27:11 +01:00
use reqwest::Client;
2023-12-17 20:18:03 +01:00
use std::fmt::Debug;
2024-05-06 20:53:38 +02:00
use systemd_journal_logger::{JournalLog};
2023-12-30 01:27:11 +01:00
mod bot;
mod config;
2023-12-17 20:18:03 +01:00
mod lemmy;
mod post_history;
mod fetchers;
2023-12-17 20:18:03 +01:00
pub static HTTP_CLIENT: Lazy<Client> = Lazy::new(|| {
2023-12-17 20:35:37 +01:00
Client::builder()
2023-09-18 23:01:22 +02:00
.timeout(Duration::seconds(30).to_std().unwrap())
.connect_timeout(Duration::seconds(30).to_std().unwrap())
.build()
2023-12-17 20:35:37 +01:00
.expect("build client")
});
#[tokio::main]
async fn main() {
2023-12-30 01:27:11 +01:00
JournalLog::new()
.expect("Systemd-Logger crate error")
.install()
.expect("Systemd-Logger crate error");
2023-12-30 00:41:29 +01:00
log::set_max_level(LevelFilter::Info);
2024-05-06 20:53:38 +02:00
bot::run().await;
}