diff --git a/src/lib/userData.js b/src/lib/userData.js index 2b633af..ccece90 100644 --- a/src/lib/userData.js +++ b/src/lib/userData.js @@ -39,7 +39,26 @@ function getUserData(id, key, fallback = null) { }); } +function deleteUserData(id, key) { + return new Promise((resolve, reject) => { + hf.database.run( + "DELETE FROM user_data WHERE key = $key", + { + $key: `${id}[${key}]`, + }, + (err) => { + if (err == null) { + resolve(true); + } else { + reject(err); + } + } + ); + }); +} + module.exports = { setUserData, getUserData, + deleteUserData, };