This commit is contained in:
TheNetsky
2023-10-11 15:08:11 +02:00
parent 085db76f4c
commit c86a903793
13 changed files with 237 additions and 260 deletions

20
src/util/Account.ts Normal file
View File

@@ -0,0 +1,20 @@
import * as fs from 'fs'
import path from 'path'
export async function loadAccounts() {
try {
let file = 'accounts.json'
// If dev mode, use dev account(s)
if (process.argv.includes('-dev')) {
file = 'accounts.dev.json'
}
const accountDir = path.join(__dirname, '../', file)
const accounts = fs.readFileSync(accountDir, 'utf-8')
return JSON.parse(accounts)
} catch (error) {
throw new Error(error as string)
}
}