Files
New-discord-bot-coins/fonctions/setDatabase.js
T
2024-06-25 13:45:14 +02:00

33 lines
765 B
JavaScript

require("dotenv").config();
const sqlite3 = require("sqlite3").verbose();
const db = new sqlite3.Database(process.env.DATABASE, (err) => {
if (err) {
console.error(err.message);
return;
}
console.log("Connected to the database.");
});
db.run(`CREATE TABLE IF NOT EXISTS prefix (
guildId TEXT NOT NULL,
prefix TEXT NOT NULL DEFAULT '${process.env.PREFIX}',
PRIMARY KEY (guildId)
)`);
db.run(`CREATE TABLE IF NOT EXISTS users (
guildId TEXT,
userId TEXT,
pocket INTEGER DEFAULT 0,
bank INTEGER DEFAULT 0,
reputation INTEGER DEFAULT 0,
level INTERGER DEFAULT 0,
xp INTERGER DEFAULT 0,
antiRob INTEGER DEFAULT 0,
lastRob INTEGER DEFAULT 0,
embed TEXT DEFAULT yellow,
PRIMARY KEY (guildId, userId)
)`);
module.exports = db;