1
0
Fork 0

Implemented a basic extraction loop

This commit is contained in:
Julien Dessaux 2023-05-14 01:50:19 +02:00
parent f190aea975
commit efdf50a55a
Signed by: adyxax
GPG key ID: F92E51B86E07177E
12 changed files with 2022 additions and 0 deletions

23
database/config.js Normal file
View file

@ -0,0 +1,23 @@
import db from './db.js';
const getTokenStatement = db.prepare(`SELECT value from config where key = 'token';`);
const registerAgentStatement = db.prepare(`INSERT INTO config(key, value) VALUES ('symbol', ?), ('faction', ?), ('token', ?);`);
export function getToken() {
try {
return getTokenStatement.get().value;
} catch (err) {
console.log(err);
return null;
}
}
export function registerAgent(symbol, faction, token) {
try {
registerAgentStatement.run(symbol, faction, token);
return true;
} catch (err) {
console.log(err);
return false;
}
}