OpenXbox / xbox-webapi-python

A python library to authenticate with Xbox Live via your Microsoft Account and provides Xbox related Web-API.
https://pypi.python.org/pypi/xbox-webapi
MIT License
175 stars 44 forks source link

How to I get the user presence info (Activity Field)? #39

Closed Gurrman375 closed 3 years ago

Gurrman375 commented 3 years ago

I'm developing an rpc and I'm unsure how to get the presence data. For example before I'd get "Current map" and "Halo CE". I've tried using xbl_client.presence.get_presence_own() but that only gives xuid='XXXXXXXXXXXXXXXX' state='Online' last_seen=None. How do I get that?

Gurrman375 commented 3 years ago

I was wrong. You can't use xbl_client.presence.get_presence_own() to get the activity field. Is there any way to get the activity field?

Alexis-Bize commented 3 years ago

Which level of presence are you using? I didn't tried it by myself though. Also, https://peoplehub.xboxlive.com/users/me/people/xuid({xuid})/decoration/presenceDetail endpoint may have what you're looking for.

Snippet:

{
    "people": [
        {
            "xuid": "...",
            ...
            "presenceState": "Online",
            "presenceText": "Vigor - Sawmill"
            ...
            "presenceDetails": [
                {
                    "IsBroadcasting": false,
                    "Device": "Scarlett",
                    "PresenceText": "Home",
                    "State": "Active",
                    "TitleId": "750323071",
                    "TitleType": null,
                    "IsPrimary": false,
                    "IsGame": false,
                    "RichPresenceText": null
                },
                {
                    "IsBroadcasting": false,
                    "Device": "Scarlett",
                    "PresenceText": "Vigor - Sawmill",
                    "State": "Active",
                    "TitleId": "872826607",
                    "TitleType": null,
                    "IsPrimary": true,
                    "IsGame": true,
                    "RichPresenceText": "Sawmill"
                }
            ],
           ...
        }
    ],
    ...
}

Also tried with Halo: The Master Chief Collection:

...
"presenceDetails": [
    {
        "IsBroadcasting": false,
        "Device": "Win32",
        "PresenceText": "Halo: The Master Chief Collection - H: R: Matchmade Game - Forge World",
        "State": "Active",
        "TitleId": "1144039928",
        "TitleType": null,
        "IsPrimary": true,
        "IsGame": true,
        "RichPresenceText": "H: R: Matchmade Game - Forge World"
    },
    {
        "IsBroadcasting": false,
        "Device": "WindowsOneCore",
        "PresenceText": "Halo: The Master Chief Collection",
        "State": "Active",
        "TitleId": "1144039928",
        "TitleType": null,
        "IsPrimary": false,
        "IsGame": true,
        "RichPresenceText": "H: R: Matchmade Game - Forge World"
    }
]
...
Gurrman375 commented 3 years ago

I don't exactly know what you mean about presence level. If you mean in presence model I used presence item. I'll go ahead and try using people model instead. The funny thing is I can get the data on xbl.io just have to deal with limiting requests.

Gurrman375 commented 3 years ago

I'm very confused on how to get the data from people provider but found out it doesn't have the function I need. I'm gonna use xbl.io requests till this gets fixed. I guess for now I'll close the issue.