Files

39 lines
958 B
Rust
Raw Permalink Normal View History

2025-04-19 20:22:08 -04:00
mod commands;
mod config;
mod discord;
mod matrix;
2025-04-19 20:22:08 -04:00
mod types;
mod util;
use std::env;
#[tokio::main]
async fn main() {
let _ = config::config();
let has_discord = env::var("DISCORD_TOKEN").is_ok();
let has_matrix = env::var("MATRIX_HOMESERVER").is_ok()
&& env::var("MATRIX_USERNAME").is_ok()
&& env::var("MATRIX_PASSWORD").is_ok();
2025-04-19 20:22:08 -04:00
match (has_discord, has_matrix) {
(true, true) => {
println!("Both Discord and Matrix credentials found; defaulting to Discord.");
discord::run().await;
}
(true, false) => {
discord::run().await;
}
(false, true) => {
matrix::run().await;
}
(false, false) => {
eprintln!(
"No credentials found. Set DISCORD_TOKEN or \
MATRIX_HOMESERVER + MATRIX_USERNAME + MATRIX_PASSWORD."
);
std::process::exit(1);
}
2025-04-19 20:22:08 -04:00
}
}