const { readFile, writeFile } = require('fs').promises; const { Client } = require('fnbr'); require("colors"); let client; (async () => { let auth; try { auth = { deviceAuth: JSON.parse(await readFile('./deviceAuth.json')) }; } catch (e) { auth = { authorizationCode: async () => Client.consoleQuestion('Please enter an authorization code: ') }; } client = new Client({ auth }); client.on('deviceauth:created', (da) => writeFile('./deviceAuth.json', JSON.stringify(da, null, 2))); await client.login(); console.log(`[FORTNITE] Logged in as ${client.user.self.displayName}`.green); })(); module.exports = { client };