This repository has been archived on 2025-06-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
unibutton/db.js
2024-11-25 14:14:21 -05:00

19 lines
No EOL
363 B
JavaScript

import sqlite3 from 'sqlite3'
import { open } from 'sqlite'
let db;
async function initDb() {
if (db) return db;
db = await open({
filename: `${process.cwd()}/db/main.db`,
driver: sqlite3.Database
});
await db.run(`CREATE TABLE IF NOT EXISTS stats (username TEXT, ip TEXT, ko TEXT);`);
return db;
}
export default initDb;