1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-22 11:04:21 +00:00
royalnet/src/main.rs

37 lines
1,004 B
Rust
Raw Normal View History

use anyhow::Result;
2024-07-11 06:05:58 +00:00
use crate::services::RoyalnetService;
2024-07-04 01:15:39 +00:00
pub(crate) mod database;
2024-07-11 05:53:51 +00:00
pub(crate) mod utils;
2024-07-11 06:05:58 +00:00
mod services;
2024-07-04 01:15:39 +00:00
#[tokio::main]
async fn main() -> Result<()> {
// Logging setup
pretty_env_logger::init();
log::debug!("Logging initialized successfully!");
// Telegram setup
2024-07-11 06:05:58 +00:00
log::trace!("Setting up Telegram bot service...");
let telegram = services::telegram::BotService::from_config();
// Run all services concurrently
log::info!("Starting services...");
let result = tokio::try_join![
telegram.run(),
];
2024-07-04 01:15:39 +00:00
// This should never happen, but just in case...
match result {
Err(error) => {
log::error!("A service has exited with an error, bailing out: {error:?}");
anyhow::bail!("A service has exited with an error.")
},
_ => {
log::error!("All service have exited successfully, bailing out...");
anyhow::bail!("All service have exited successfully.")
}
}
2024-07-04 01:15:39 +00:00
}