Improve whitelist feature
All checks were successful
CI / CI (push) Successful in 1m23s

* Use a primary autoincrementing primary key because primary keys need
  to be unique
* Cache whitelist on bot startup / only read from database once
* "Externalize" whitelist checking to the messageCreate function.
This commit is contained in:
SileNce5k 2025-04-30 15:55:53 +02:00
parent c9d7a54e25
commit ba88243dea
Signed by: SileNce
GPG key ID: B0A142BB4291B204
5 changed files with 56 additions and 46 deletions

View file

@ -4,7 +4,8 @@ module.exports = async function () {
return new Promise ((resolve, reject)=>{
db.run(
`CREATE TABLE IF NOT EXISTS whitelist (
serverId TEXT PRIMARY KEY,
Id INTEGER PRIMARY KEY AUTOINCREMENT,
serverId TEXT,
command TEXT,
dateAdded INTEGER)`,
(err) => {