All Projects → iXyles → fortnite-basic-api

iXyles / fortnite-basic-api

Licence: MIT License
Basic Fortnite API for stats with async/await, and basic communicator

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to fortnite-basic-api

Fortnite-LobbyBot
Uses JavaScript to emulate a Fortnite client and can join parties through HTTP and change skins / emotes visually.
Stars: ✭ 20 (-56.52%)
Mutual labels:  fortnite, fortnite-bot
Ezfn Lobbybot
With EasyFNBot you can easily create you own Fortnite Lobby Bot in less than 5 minutes which will be online forever!
Stars: ✭ 6,875 (+14845.65%)
Mutual labels:  fortnite, fortnite-bot
Fortnite-LobbyBot
No description or website provided.
Stars: ✭ 38 (-17.39%)
Mutual labels:  fortnite, fortnite-bot
fortnitepy
Async python library for interacting with Fortnite's API and XMPP services.
Stars: ✭ 118 (+156.52%)
Mutual labels:  fortnite, fortnite-stats
game apis
This repository is for integrating with different apis to allow you to pull player or game data
Stars: ✭ 24 (-47.83%)
Mutual labels:  fortnite, fortnite-stats
fn-rate
🌠 Rate the skins of Fortnite and see what skins are most appreciated!
Stars: ✭ 14 (-69.57%)
Mutual labels:  node-js, fortnite
node-epicgames-fortnite-client
Unofficial javascript client for Fortnite.
Stars: ✭ 55 (+19.57%)
Mutual labels:  fortnite, fortnite-stats
onetricks.net
(WIP) kayn-powered (typescript node.js) ReasonReact app presenting you a dashboard of high ELO one trick ponies in League of Legends
Stars: ✭ 13 (-71.74%)
Mutual labels:  node-js
esiJS
A simple Node module for EVE Onlines' ESI.
Stars: ✭ 17 (-63.04%)
Mutual labels:  node-js
sourcemaps.io
Web-based Source Map validator
Stars: ✭ 50 (+8.7%)
Mutual labels:  node-js
node-js-jwt-auth
Node.js Demo for Token Based Authentication (JWT) with MySQL database
Stars: ✭ 161 (+250%)
Mutual labels:  node-js
node-telegram-keyboard-wrapper
A support to manage keyboards and force replies in Telegram via bots
Stars: ✭ 32 (-30.43%)
Mutual labels:  node-js
ReplAPI.it-NodeJS
[DEPRECIATED] 𝙀𝙫𝙚𝙧𝙮𝙩𝙝𝙞𝙣𝙜 𝙍𝙚𝙥𝙡𝙞𝙩, 𝙖𝙡𝙡 𝙖𝙩 𝙮𝙤𝙪𝙧 𝙙𝙞𝙨𝙥𝙤𝙨𝙖𝙡. This is the single most extensive Replit package, allowing you to access various parts of the site with just a few classes and methods. Maintained by @RayhanADev.
Stars: ✭ 32 (-30.43%)
Mutual labels:  node-js
Discord-Reposter
Bot for reposting Discord messages (work in progress)
Stars: ✭ 62 (+34.78%)
Mutual labels:  node-js
cocoon-demo
Cocoon – a flow-based workflow automation, data mining and visual analytics tool.
Stars: ✭ 19 (-58.7%)
Mutual labels:  node-js
timeoff-server
TimeOff is an application that allows companies' employees to set vacations before they begin taking their time off. Implemented in modern tech stack i.e. Node, Express, MongoDB.
Stars: ✭ 33 (-28.26%)
Mutual labels:  node-js
rustwasmc
Tool for building Rust functions for Node.js. Combine the performance of Rust, safety and portability of WebAssembly, and ease of use of JavaScript.
Stars: ✭ 97 (+110.87%)
Mutual labels:  node-js
FortniteApi
An C# client library for the TrackerNetwork Fortnite API.
Stars: ✭ 15 (-67.39%)
Mutual labels:  fortnite
TODO-List-Tech-Module
TODO List (in C#, Java, JS and PHP) - Exam Preparation for the Tech Module @ SoftUni (August 2017)
Stars: ✭ 13 (-71.74%)
Mutual labels:  node-js
MERN-BUS-APP
This is a MFRP (My first Real Project) assigned to me during my internship at Cognizant. Made with MERN Stack technology.
Stars: ✭ 92 (+100%)
Mutual labels:  node-js

fortnite-basic-api

npm version npm downloads license

Basic Fortnite API for stats and server status built with async/await

Inspired by other repos about Fortnite API's as:

Which I previously used fortnite-api but have gotten issues with unhandledrejections which causing issues in other projects. Therefore I rebuilt with focus on Async/await to resolve the issues and adding support for V2 API endpoint. If you've a question feel free to create an issue - PS: No I'll not add party support. If you may want that sort of functionallity look into - https://www.npmjs.com/package/fnbr instead :)

Example usage:

const { Client, Communicator, FriendStatus } = require('fortnite-basic-api');

// Creation of the Client, autokill will kill the session when client is disposed.
// If you are not giving any tokens it will use the default ones that are needed.
// If you got rate limited (captcha_invalid) you can use an exchangeCode to generate a deviceauth.
// You get the exchangeCode at https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fexchange.
// Remember that you must be logged in with the account you want at https://epicgames.com
// AND BE CAREFUL! The generated code bypasses all 2FA logins & credentials, so do not share it.
const client = new Client({
  email: process.env.FORTNITE_EMAIL, // PLEASE USE ENV VARIABLES!
  password: process.env.FORTNITE_PASSWORD, // PLEASE USE ENV VARIABLES!
  // You should not have to update any of the tokens.
  launcherToken: 'MzRhMDJjZjhmNDQxNGUyOWIxNTkyMTg3NmRhMzZmOWE6ZGFhZmJjY2M3Mzc3NDUwMzlkZmZlNTNkOTRmYzc2Y2Y=',
  fortniteToken: 'ZWM2ODRiOGM2ODdmNDc5ZmFkZWEzY2IyYWQ4M2Y1YzY6ZTFmMzFjMjExZjI4NDEzMTg2MjYyZDM3YTEzZmM4NGQ=',
  autokill: true,
});

// Creation of communicator
const communicator = new Communicator(client);

// Example of usage
(async () => {
  // Perform the login process of the "client"
  console.log(await client.authenticator.login());

  // Setup communicator events
  communicator.events.on('session:started', async () => {
    console.log('XMPP Client is fully connected');
    console.log('Add friend: ', await communicator.friendship.addFriend('iXyles')); // example of how to add a friend
    console.log(await communicator.friendship.getFriends()); // get current friends
    console.log(await communicator.friendship.getIncomingFriendRequests()); // incoming
    console.log(await communicator.friendship.getOutgoingFriendRequests()); // outgoing
  });

  communicator.events.on('friend:request', async (friendrequest) => {
    if (friendrequest.friendStatus === FriendStatus.INCOMING) {
      console.log(friendrequest, await friendrequest.accept());
    }
  });

  communicator.events.on('reconnect', async (failure) => {
    if (failure) {
      console.log(failure); // reason to why it failed, currently only if token update failed
    }
  });

  communicator.events.on('friend:added', async (friend) => {
    console.log(`You're now friend with: ${friend.accountId}`);
  });

  communicator.events.on('friend:reject', async (friend) => {
    console.log(`You got rejected the friend request by: ${friend.accountId}`);
  });

  communicator.events.on('friend:removed', async (friend) => {
    console.log(`You're now unfriended with: ${friend.accountId}`);
  });

  communicator.events.on('friend:abort', async (friend) => {
    console.log(`Friendrequest aborted with: ${friend.accountId}`);
  });

  communicator.events.on('friend:presence', (friend) => {
    console.log(friend.presence);
  });

  communicator.events.on('friend:message', async (friend) => {
    console.log(await friend.getStatus());
    console.log('message', await friend.sendMessage('Send something back'));
  });

  // Then connect it
  console.log(await communicator.connect());

  // Since everything is async based, we can query everything parallel how ever we want with await
  const parallel = await Promise.all([
    // Supports both name & id
    client.stats.getV2Stats('iXyles'),
    client.stats.getV2Stats('96afefcb12e14e7fa1bcfab1189eae55'),

    // Or maybe just lookup?
    client.lookup.accountLookup('iXyles'),
    client.lookup.accountLookup('96afefcb12e14e7fa1bcfab1189eae55'),

    // or maybe a couple at a time?
    client.lookup.accountLookup(['iXyles', '96afefcb12e14e7fa1bcfab1189eae55']),

    client.getServerStatus(),
    client.getBRNews('es'), // insert a different language code if wanted
    client.getBRStore(),
    client.getPVEInfo(),
    client.getBREventFlags(),

    // or maybe the current logged in user accountId
    client.authenticator.accountId,
  ]);

  (parallel).forEach((result) => {
    console.log(result);
  });

  // Node will die and print that the session has been killed if login was successful
})();

License

MIT License

Copyright (c) 2019-2021 iXyles

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].