-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
316 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
npm i | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
# FN-RPC | ||
Simple Fortnite Discord RPC | ||
Display your Fortnite Statistics on your Discord Profile! | ||
|
||
#### SETUP GUIDE | ||
|
||
1. Install [Node.JS](https://nodejs.org/en) | ||
2. Run INSTALL PACKAGES.bat | ||
3. Obtain an API Key from [Fortnite-API.com](https://dash.fortnite-api.com/account) | ||
4. Paste your API Key to the apiKey field in settings.json | ||
5. Paste in your Epic Games Account ID to the epicID field in settings.json | ||
6. Run start.bat | ||
|
||
### Common Issues | ||
> The RPC won't connect! | ||
Make sure you have the Desktop version of Discord, not the browser version. If you use Vesktop (Discord Client with Vencord preinstalled), make sure you have Rich Presence enabled in your Vesktop settings. | ||
|
||
> I keep getting error: "the requested account's stats are not public" | ||
Launch Fortnite & Go to the Account & Privacy Settings, then set Public Game Stats to ON: | ||
<img src="https://vee.hates.college/6gDvqbwlE"/> | ||
|
||
> How do I get my Epic Games Account ID? | ||
Launch Fortnite & Go to the Account & Privacy Settings, then click Copy to Clipboard. | ||
<img src="https://vee.hates.college/6gDxp3yzM"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const { Client } = require("discord-rpc"); | ||
const rpc = new Client({ transport: "ipc" }); | ||
const axios = require("axios"); | ||
|
||
const { clientID, epicID, apiKey, assets } = require("./settings.json"); | ||
|
||
async function GetStats() { | ||
try { | ||
await axios.get(`https://fortnite-api.com/v2/stats/br/v2/${epicID}`, { | ||
headers: { | ||
'Authorization': apiKey | ||
} | ||
}).catch(err => { | ||
if (err.response) throw `[ERROR] ${err.response.data.error}, Status Code: ${err.response.data.status}`; | ||
if (err) throw err; | ||
}).then(res => { | ||
let data = res.data.data; | ||
|
||
return setStatus(data.battlePass.level, data.stats.all.overall.wins, data.stats.all.overall.kills, data.stats.all.overall.deaths, data.battlePass.progress, data.account.name); | ||
}); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
|
||
async function setStatus(bp, wins, kills, deaths, progress, username) { | ||
rpc.setActivity({ | ||
details: `👑 ${bp.toLocaleString()} | ${progress}% (${100 - progress}% Left)`, | ||
state: `🏆 ${wins.toLocaleString()} | 🎯 ${kills.toLocaleString()} | 💀 ${deaths.toLocaleString()}`, | ||
largeImageKey: assets.large_img_key, | ||
largeImageText: `Fortnite Stats for: ${username}` | ||
}); | ||
await new Promise((p => setTimeout(p, 60000))); | ||
GetStats(); | ||
} | ||
|
||
rpc.on("ready", async () => { | ||
console.log('FN-RPC is now initalized.'); | ||
GetStats(); | ||
}) | ||
|
||
rpc.login({ | ||
clientId: clientID | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "fn-rpc", | ||
"version": "1.0.0", | ||
"description": "Simple Fortnite Discord RPC", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/RiftSTW/FN-RPC.git" | ||
}, | ||
"keywords": [ | ||
"Fortnite" | ||
], | ||
"author": "RiftSTW", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/RiftSTW/FN-RPC/issues" | ||
}, | ||
"homepage": "https://github.com/RiftSTW/FN-RPC#readme", | ||
"dependencies": { | ||
"axios": "^1.5.1", | ||
"discord-rpc": "^4.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"clientID": "1161759792507932755", | ||
"epicID": "", | ||
"apiKey": "", | ||
"assets": { "large_img_key": "fn" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
node index.js | ||
pause |