inital project

This commit is contained in:
Lee
2023-04-09 07:49:29 +01:00
parent e0b14cca01
commit 3c1a1b8d61
13 changed files with 497 additions and 1 deletions

34
index.js Normal file
View File

@ -0,0 +1,34 @@
require("dotenv").config();
const { Client: FortniteAPI, Language } = require("fnapicom");
const ACCOUNTS_TO_TRACK = process.env.FORTNITE_USERNAMES.includes(",")
? process.env.FORTNITE_USERNAMES.split(",")
: [process.env.FORTNITE_USERNAMES];
const client = new FortniteAPI({
language: Language.English,
apiKey: process.env.API_KEY,
});
trackAccounts();
setInterval(() => {
trackAccounts();
}, 60_000);
async function trackAccounts() {
for (const username of ACCOUNTS_TO_TRACK) {
try {
const account = await client.brStats({
name: username,
});
if (account.status !== 200) {
console.error(`Error: ${account.status}`);
continue;
}
console.log("works");
} catch (error) {
console.error(error);
}
}
}