Skip to content

Commit

Permalink
Merge pull request #12 from Gurrman375/master
Browse files Browse the repository at this point in the history
Stability and other improvements
  • Loading branch information
kay-el-zed authored May 29, 2021
2 parents 61691d2 + 1829007 commit bbad9d7
Show file tree
Hide file tree
Showing 27 changed files with 177 additions and 1,051 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@

A python script that grabs your XBL status for Halo MCC and shows it as a Discord rich presence status.

![image](https://i.imgur.com/51Zdnv9l.png)

![image](https://user-images.githubusercontent.com/25113575/118538638-509a3380-b703-11eb-8714-63601a201dc9.png)
![image](https://user-images.githubusercontent.com/25113575/119899512-07629480-bef8-11eb-949b-cb5b6ad568d7.png)

![image](https://user-images.githubusercontent.com/25113575/119900126-ec445480-bef8-11eb-9f87-82e376668f27.png)

<h2>How to use</h2>

1. Install both requirements using pip
2. Update discord_client_id with your valid application's client ID from the [Discord developer portal](https://discordapp.com/developers).
Running the Presence:
Run Step 1:
![image](https://user-images.githubusercontent.com/25113575/119243523-51c0cb80-bb1c-11eb-9369-6b0772a0156b.png)

Login and agree to the app getting your data:
![image](https://user-images.githubusercontent.com/25113575/119243543-8cc2ff00-bb1c-11eb-8b4e-e0762584d05e.png)

Copy the link you get:
![image](https://user-images.githubusercontent.com/25113575/119243561-bed46100-bb1c-11eb-8414-1cb560f79f0c.png)

3. Run the latest [release](https://github.com/kay-el-zed/HaloMCC-DiscordRPC/releases).
Enter the link in the prompt (The links expire quickly):
![image](https://user-images.githubusercontent.com/25113575/119243702-2b9c2b00-bb1e-11eb-9ae8-eaee95f0a77b.png)


1. Input your xbox sign on account. (Data is stored in AppData/Local/OpenXbox/xbox)
2. When prompted, enter your valid application's CID(client ID) from the [Discord developer portal](https://discord.com/developers/applications), along with a small and large image. (If you don't know how to do this, leave the option blank and default settings will be used.)
3. It will wait until it sees Halo MCC in your Xbox Live presence to display a rich status on Discord.
Launch the Rich Presence and enjoy:
![image](https://user-images.githubusercontent.com/25113575/119906785-bbb5e800-bf03-11eb-963a-1a74b833a724.png)

<h2>Requirements for Building</h2>

* [pypresence](https://github.com/qwertyquerty/pypresence)
* [xboxlive-api](https://github.com/XboxReplay/xboxlive-api)
* [xboxlive-auth](https://github.com/XboxReplay/xboxlive-auth/tree/4.0.0)
* A client ID for an application created in the [Discord developer portal](https://discordapp.com/developers)
* Sample images for 'cover' and 'win10' as shown above are provided for creating your own application.
* [pyinstaller](https://www.pyinstaller.org/downloads.html) for building the executable.
Expand Down
Binary file modified __pycache__/dictionary.cpython-37.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion dictionary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from typing_extensions import TypeGuard

def jsonDictionary(dictionary):
haloreachdictionary = {
"Easy" : "a_easy",
Expand Down
Binary file added discord-app-images/Other Images/steam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 7 additions & 17 deletions dist/richpresence.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { call } = require('@xboxreplay/xboxlive-api');
const { writeFileSync, readFileSync } = require('fs');
let config, response, deviceDetails;
let config, response;

const nullactivity = {
details: "",
Expand All @@ -15,6 +15,7 @@ const jsonfile = __dirname + '/rpc.json';
async function richPresence(){
// Get Xbox credentials
const data = JSON.parse(readFileSync((__dirname + "/tokens/xtoken.json")));
const steamid = JSON.parse(readFileSync((__dirname + "/rpc.json")))
const authorization = {
userHash: data['DisplayClaims']['xui'][0]['uhs'],
XSTSToken: data['Token'],
Expand All @@ -41,7 +42,7 @@ async function richPresence(){
if((response['people'][0]['presenceDetails'][i]['PresenceText'].startsWith("Halo: The Master Chief Collection -"))){

presenceText = response['people'][0]['presenceDetails'][i]['PresenceText'].split(" - ");
console.log(presenceText);
//console.log(presenceText);
device = response['people'][0]['presenceDetails'][i]['Device'];

i = presenceText.length;
Expand All @@ -50,9 +51,10 @@ async function richPresence(){
details: presenceText[2],
state: presenceText[1],
device: device,
game: presenceText[0]
game: presenceText[0],
steamid: steamid['steamid']
};
console.log(activity);
console.log("\nDiscord Status is: \n" + JSON.stringify(activity, null, 2));
try{
writeFileSync(jsonfile, JSON.stringify(activity, null, 2));
}
Expand All @@ -72,16 +74,4 @@ async function richPresence(){
}
return;
}
richPresence();

/**
* args.u, args.p
steamid: "",
gameid: "976730",
lobbysteamid: ""
steam://joinlobby/
976730/ <------ Game ID
lobbysteamid/ <------ Lobby ID
steamid <------ Steam ID
80EC429274AF252714363656B71562C0 <------ API Key
*/
richPresence();
8 changes: 7 additions & 1 deletion dist/rpc.json
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
{"details": "", "state": "", "device": "", "game": ""}
{
"details": "Title Screen",
"state": "Main Menu",
"device": "Win32",
"game": "Halo: The Master Chief Collection",
"steamid": "76561198293744031"
}
63 changes: 0 additions & 63 deletions old/.gitattributes

This file was deleted.

Loading

0 comments on commit bbad9d7

Please sign in to comment.