fix: was still using the username in some palces instead of ID
This commit is contained in:
parent
70690f712e
commit
058fe2538a
1 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,7 @@ pub(crate) mod link {
|
||||||
|
|
||||||
db_pending_clear_expired(&db).await;
|
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();
|
return "Linking already in process, please check email.".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ pub(crate) mod link {
|
||||||
.ok()
|
.ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_verify_from_db(db: &Pool<Sqlite>, user: &str) -> Option<WolvesVerify> {
|
pub async fn get_verify_from_db(db: &Pool<Sqlite>, user: &UserId) -> Option<WolvesVerify> {
|
||||||
sqlx::query_as::<_, WolvesVerify>(
|
sqlx::query_as::<_, WolvesVerify>(
|
||||||
r#"
|
r#"
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -213,7 +213,7 @@ pub(crate) mod link {
|
||||||
WHERE discord = ?
|
WHERE discord = ?
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.bind(user)
|
.bind(*user.as_u64() as i64)
|
||||||
.fetch_one(db)
|
.fetch_one(db)
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
|
@ -250,7 +250,7 @@ pub(crate) mod verify {
|
||||||
let db = db_lock.read().await;
|
let db = db_lock.read().await;
|
||||||
|
|
||||||
// check if user has used /link
|
// 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
|
x
|
||||||
} else {
|
} else {
|
||||||
return "Please use /link first".to_string();
|
return "Please use /link first".to_string();
|
||||||
|
|
Loading…
Reference in a new issue