JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
122 stars 23 forks source link

Relationship error (java-impl branch) #72

Closed gravit0 closed 1 month ago

gravit0 commented 1 year ago

The user encountered the following error:

023.10.31 16:25:43 [DEV] Received string "{"cmd":"SUBSCRIBE","data":{"evt":"OVERLAY_UPDATE"},"evt":null,"nonce":"1"}" at state CONNECTED
2023.10.31 16:25:43 [DEBUG] Registered event OVERLAY_UPDATE
2023.10.31 16:25:43 [DEV] Received string "{"cmd":"DISPATCH","data":{"enabled":true,"locked":true},"evt":"OVERLAY_UPDATE","nonce":null}" at state CONNECTED
2023.10.31 16:25:43 [DEV] Received string "{"cmd":"SUBSCRIBE","data":{"evt":"VOICE_SETTINGS_UPDATE_2"},"evt":null,"nonce":"2"}" at state CONNECTED
2023.10.31 16:25:43 [DEBUG] Registered event VOICE_SETTINGS_UPDATE_2
2023.10.31 16:25:43 [DEV] Received string "{"cmd":"DISPATCH","data":{"input_mode":{"type":"VOICE_ACTIVITY","shortcut":"[object Undefined]"},"local_mutes":[],"local_volumes":{},"self_mute":false,"self_deaf":false},"evt":"VOICE_SETTINGS_UPDATE_2","nonce":null}" at state CONNECTED
2023.10.31 16:25:44 [DEV] Received string "{"cmd":"SUBSCRIBE","data":{"evt":"RELATIONSHIP_UPDATE"},"evt":null,"nonce":"3"}" at state CONNECTED
2023.10.31 16:25:44 [DEBUG] Registered event RELATIONSHIP_UPDATE
2023.10.31 16:25:44 [DEV] Received string "{"cmd":"GET_RELATIONSHIPS","data":{"code":4006,"message":"Not authenticated or invalid scope"},"evt":"ERROR","nonce":"4"}" at state CONNECTED
2023.10.31 16:25:44 [ERROR] java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because the return value of "de.jcm.discordgamesdk.impl.commands.GetRelationships$Response.getRelationships()" is null
        at de.jcm.discordgamesdk.RelationshipManager.lambda$new$5(Unknown Source)
        at de.jcm.discordgamesdk.Core.handleCommand(Unknown Source)
        at de.jcm.discordgamesdk.Core.runCallbacks(Unknown Source)
        at MYCODE.run(Unknown Source)
        at java.base/java.lang.Thread.run(Thread.java:1583)
JnCrMx commented 11 months ago

It looks like getting the relationships requires extra authorization, which I don't know how to obtain... I've made a commit, so the library no longer throws an exception, if this command fails. I will have to investigate if the official Discord Game SDK does something different when it comes to getting the relationships.

JnCrMx commented 1 month ago

Update: This seems to be broken in the official SDK as well. So there is nothing I can do except silently ignoring the error...