-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.js
More file actions
27 lines (20 loc) · 658 Bytes
/
Copy pathsql.js
File metadata and controls
27 lines (20 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const sqlite3 = require("sqlite3")
const db = new sqlite3.Database('./data.db', (err) => {
if (err) {
console.error(err.message);
}
console.log('Connected to the blacklist database.');
db.run("CREATE TABLE IF NOT EXISTS blacklisted (reason TEXT, id TEXT)")
});
const blackListUser = db.prepare("INSERT INTO blacklisted VALUES (?,?)")
const checkBlackListUser = db.prepare("SELECT reason FROM blacklisted WHERE id = ?")
function autoBlackList(id, reason) {
blackListUser.run(reason, id)
};
function checkBlackList(id, cb) {
checkBlackListUser.get(id, cb)
};
module.exports = {
autoBlackList : autoBlackList,
checkBlackList : checkBlackList
}