diff --git a/src/main.rs b/src/main.rs index 975a9d7..9b81a04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ use poise::serenity_prelude::{self as serenity, GatewayIntents}; -use dotenv; mod command; pub struct Data {} // User data, which is stored and accessible in all command invocations @@ -101,10 +100,15 @@ fn read_env() -> BotEnv { dotenv::dotenv().ok(); // ==================== ID =========================== let id: String = std::env::var(DISCORD_ID) - .expect(&format!("WARN: Missing {DISCORD_ID}\n> This isn't really that problematic, just that the generated invite link won't work.")); + .unwrap_or_else(|_| { + println!(r#" +WARN: Missing {DISCORD_ID} +> This isn't really that problematic, just that the generated invite link won't work."#); + String::from("") + }); // ==================== Token ======================== let token: String = std::env::var(DISCORD_TOKEN) - .expect(&format!("ERROR: Missing {DISCORD_TOKEN}")); + .unwrap_or_else(|_| panic!("ERROR: Missing {DISCORD_TOKEN}")); // ==================== Intents ====================== let intents_env: String = std::env::var(DISCORD_INTENTS) .unwrap_or_else(|msg| {