aob-lemmy-bot/src/main.rs

32 lines
742 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;
2024-05-06 20:53:38 +02:00
use systemd_journal_logger::{JournalLog};
2024-05-07 22:10:21 +02:00
use crate::bot::Bot;
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()
.timeout(Duration::seconds(10).to_std().unwrap())
.connect_timeout(Duration::seconds(10).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-07 22:10:21 +02:00
let mut bot = Bot::new();
bot.run().await;
}