diff --git a/src/commands/link_email.rs b/src/commands/link_email.rs index 4ca115e..51fd628 100644 --- a/src/commands/link_email.rs +++ b/src/commands/link_email.rs @@ -38,7 +38,7 @@ pub(crate) mod link { db_pending_clear_expired(&db).await; - if get_verify_from_db(&db, &command.user.name).await.is_some() { + if get_verify_from_db(&db, &command.user.id).await.is_some() { return "Linking already in process, please check email.".to_string(); } @@ -205,7 +205,7 @@ pub(crate) mod link { .ok() } - pub async fn get_verify_from_db(db: &Pool, user: &str) -> Option { + pub async fn get_verify_from_db(db: &Pool, user: &UserId) -> Option { sqlx::query_as::<_, WolvesVerify>( r#" SELECT * @@ -213,7 +213,7 @@ pub(crate) mod link { WHERE discord = ? "#, ) - .bind(user) + .bind(*user.as_u64() as i64) .fetch_one(db) .await .ok() @@ -250,7 +250,7 @@ pub(crate) mod verify { let db = db_lock.read().await; // check if user has used /link - let details = if let Some(x) = get_verify_from_db(&db, &command.user.name).await { + let details = if let Some(x) = get_verify_from_db(&db, &command.user.id).await { x } else { return "Please use /link first".to_string();