mirror of
https://github.com/DerTyp7/discord-twitch-bot.git
synced 2025-10-29 12:52:12 +01:00
25 lines
598 B
JavaScript
25 lines
598 B
JavaScript
const sqlite3 = require("sqlite3").verbose();
|
|
const db = new sqlite3.Database("../database.sqlite");
|
|
|
|
function createDatabaseStructure() {
|
|
db.serialize(() => {
|
|
db.run(
|
|
"CREATE TABLE server (id INTEGER, ownerId INTEGER, twitchOAuth TEXT)"
|
|
);
|
|
});
|
|
}
|
|
|
|
function insertServer(id, ownerId, twitchOAuth) {
|
|
db.serialize(() => {
|
|
db.run(
|
|
`INSERT INTO server(id, ownerId, twitchOAuth) VALUES(${id}, ${ownerId}, '${
|
|
twitchOAuth ? twitchOAuth : "null"
|
|
}')`
|
|
);
|
|
});
|
|
}
|
|
|
|
// createDatabaseStructure();
|
|
|
|
module.exports = { db, insertServer, createDatabaseStructure };
|