fix clippy warnings

This commit is contained in:
Oliver Atkinson 2023-11-02 23:20:31 -06:00
parent 71589c3f5d
commit 1e035859fb

View File

@ -1,5 +1,4 @@
use poise::serenity_prelude::{self as serenity, GatewayIntents}; use poise::serenity_prelude::{self as serenity, GatewayIntents};
use dotenv;
mod command; mod command;
pub struct Data {} // User data, which is stored and accessible in all command invocations 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(); dotenv::dotenv().ok();
// ==================== ID =========================== // ==================== ID ===========================
let id: String = std::env::var(DISCORD_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 ======================== // ==================== Token ========================
let token: String = std::env::var(DISCORD_TOKEN) let token: String = std::env::var(DISCORD_TOKEN)
.expect(&format!("ERROR: Missing {DISCORD_TOKEN}")); .unwrap_or_else(|_| panic!("ERROR: Missing {DISCORD_TOKEN}"));
// ==================== Intents ====================== // ==================== Intents ======================
let intents_env: String = std::env::var(DISCORD_INTENTS) let intents_env: String = std::env::var(DISCORD_INTENTS)
.unwrap_or_else(|msg| { .unwrap_or_else(|msg| {