interplane.Get Omega
Read in your language

aien-sovereign-core

Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core / crates / spark-discord-hub / src / main.rs

50 lines · 1396 bytes Raw Blame History
1use clap::Parser;
2use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
3
4mod atlas_bot;
5mod gateway;
6mod gideon_bot;
7mod models;
8mod vault;
9
10use gateway::DiscordGatewayHub;
11use vault::get_vault_secret;
12
13#[derive(Parser, Debug)]
14#[command(name = "spark-discord-hub", about = "Sovereign Native Multi-Bot Discord Hub in Rust")]
15struct Cli {
16 #[arg(long)]
17 token: Option<String>,
18}
19
20#[tokio::main]
21async fn main() -> Result<(), Box<dyn std::error::Error>> {
22 tracing_subscriber::registry()
23 .with(tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()))
24 .with(tracing_subscriber::fmt::layer())
25 .init();
26
27 let cli = Cli::parse();
28
29 tracing::info!("Initializing SparkOS Discord Multi-Bot Hub...");
30
31 // Dynamic resolution from TPM vault
32 let token = cli.token
33 .or_else(|| get_vault_secret("DISCORD_BOT_TOKEN"))
34 .or_else(|| get_vault_secret("DISCORD_ATLAS_TOKEN"));
35
36 let token = match token {
37 Some(t) if !t.is_empty() => t,
38 _ => {
39 tracing::error!("No Discord bot token found in atlas-vault (DISCORD_BOT_TOKEN). Exiting.");
40 std::process::exit(1);
41 }
42 };
43
44 tracing::info!("Discord bot token dynamically resolved from TPM vault. Starting gateway hub...");
45
46 let hub = DiscordGatewayHub::new(token);
47 hub.run().await?;
48
49 Ok(())
50}