lib.userData: add delete

This commit is contained in:
Cynthia Foxwell 2021-07-23 22:19:54 -06:00
parent 133e71961f
commit 6e536d850c

View file

@ -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,
};