diff --git a/src/commands.rs b/src/commands.rs index 8edbf89..4330ed3 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -157,7 +157,7 @@ pub async fn add_auth_user( #[description = "Discord user ID"] id: String, ) -> Result<(), Error> { if !std::env::var("ADMIN_USERS") - .expect("missing ADMIN_USERS") + .unwrap_or(String::new()) .contains(&ctx.author().id.to_string()) { ctx.say("You don't have permission to add a new user") diff --git a/src/database.rs b/src/database.rs index 8ab5806..2c482cf 100644 --- a/src/database.rs +++ b/src/database.rs @@ -90,8 +90,7 @@ pub fn is_auth_user(discord_id: String) -> Result { .get() .unwrap() .collection::("authorized_users") - .find(doc! { "$eq": [{"discord_id": discord_id}] }) + .find_one(doc! { "discord_id": discord_id }) .map_err(|err| Error::new(ErrorKind::InvalidInput, err))? - .next() .is_some()) }