mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 07:25:36 +01:00
39 lines
912 B
Rust
39 lines
912 B
Rust
use std::str::FromStr;
|
|
use std::sync::atomic::{AtomicBool, Ordering};
|
|
use std::sync::Arc;
|
|
|
|
use sentry::integrations::debug_images::DebugImagesIntegration;
|
|
use sentry::types::Dsn;
|
|
use sentry::ClientOptions;
|
|
|
|
mod bots;
|
|
mod bots_manager;
|
|
mod config;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
tracing_subscriber::fmt()
|
|
.with_target(false)
|
|
.compact()
|
|
.init();
|
|
|
|
let options = ClientOptions {
|
|
dsn: Some(Dsn::from_str(&config::CONFIG.sentry_dsn).unwrap()),
|
|
default_integrations: false,
|
|
..Default::default()
|
|
}
|
|
.add_integration(DebugImagesIntegration::new());
|
|
|
|
let _guard = sentry::init(options);
|
|
|
|
let running = Arc::new(AtomicBool::new(true));
|
|
let r = running.clone();
|
|
|
|
ctrlc::set_handler(move || {
|
|
r.store(false, Ordering::SeqCst);
|
|
})
|
|
.expect("Error setting Ctrl-C handler");
|
|
|
|
bots_manager::BotsManager::start(running).await;
|
|
}
|