forked from Skynet/discord-bot
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;
|
||||
|
||||
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<Sqlite>, user: &str) -> Option<WolvesVerify> {
|
||||
pub async fn get_verify_from_db(db: &Pool<Sqlite>, user: &UserId) -> Option<WolvesVerify> {
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue