inital project
This commit is contained in:
34
index.js
Normal file
34
index.js
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user