mirror of
https://github.com/DerTyp7/discord-twitch-bot.git
synced 2025-10-30 13:17:11 +01:00
init
This commit is contained in:
24
bot/database_handler.js
Normal file
24
bot/database_handler.js
Normal file
@@ -0,0 +1,24 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user