mirror of
https://github.com/arthur-pbty/gestion-perso.git
synced 2026-06-16 08:12:36 +02:00
Mettre à jour les commandes ping et setprefix, ajouter la vérification des permissions, et initialiser la base de données.
This commit is contained in:
+28
-12
@@ -6,14 +6,6 @@ module.exports = function initDB() {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
console.log('Connected to the db.db database.');
|
||||
});
|
||||
|
||||
db.run(`PRAGMA foreign_keys = ON;`, (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
console.log('Foreign key constraint enabled');
|
||||
});
|
||||
|
||||
|
||||
@@ -24,9 +16,9 @@ module.exports = function initDB() {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
console.log('Created prefix table');
|
||||
});
|
||||
|
||||
|
||||
db.run(`CREATE TABLE IF NOT EXISTS users(
|
||||
serverID TEXT NOT NULL,
|
||||
userID TEXT NOT NULL,
|
||||
@@ -34,12 +26,37 @@ module.exports = function initDB() {
|
||||
bank INTEGER NOT NULL DEFAULT 0,
|
||||
xp INTEGER NOT NULL DEFAULT 0,
|
||||
levels INTEGER NOT NULL DEFAULT 0,
|
||||
messages INTEGER NOT NULL DEFAULT 0
|
||||
messages INTEGER NOT NULL DEFAULT 0,
|
||||
buyer BOOLEAN NOT NULL DEFAULT 0,
|
||||
owner BOOLEAN NOT NULL DEFAULT 0,
|
||||
whitelist BOOLEAN NOT NULL DEFAULT 0,
|
||||
blacklist BOOLEAN NOT NULL DEFAULT 0
|
||||
)`, (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
db.run(`CREATE TABLE IF NOT EXISTS commands(
|
||||
command TEXT NOT NULL,
|
||||
permission INTEGER NOT NULL DEFAULT 11,
|
||||
serverID TEXT NOT NULL
|
||||
)`, (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
db.run(`CREATE TABLE IF NOT EXISTS permissions(
|
||||
permission INTEGER NOT NULL UNIQUE,
|
||||
roleID TEXT NOT NULL,
|
||||
serverID TEXT NOT NULL
|
||||
)`, (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
console.log('Created users table');
|
||||
});
|
||||
|
||||
|
||||
@@ -47,6 +64,5 @@ module.exports = function initDB() {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
}
|
||||
console.log('Close the database connection.');
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user