Chew / JDA-Chewtils

Chew's fork of JDA-Applications/JDA-Utilities, with support for modern features such as Slash Commands, Context Menus, and more.
https://chew.pro/JDA-Chewtils
Apache License 2.0
73 stars 24 forks source link

JSONObject["permissions"] is not an int when running Session#getGuilds #51

Closed HeyBanditoz closed 2 years ago

HeyBanditoz commented 2 years ago

Issue Checklist

Affected Modules

OAuth2

Description

When I call Session#getGuilds, I get this error:

org.json.JSONException: JSONObject["permissions"] is not an int.
    at org.json.JSONObject.getInt(JSONObject.java:603)
    at com.jagrosh.jdautilities.oauth2.entities.impl.OAuth2ClientImpl$3.handle(OAuth2ClientImpl.java:191)
    at com.jagrosh.jdautilities.oauth2.entities.impl.OAuth2ClientImpl$3.handle(OAuth2ClientImpl.java:170)
    at com.jagrosh.jdautilities.oauth2.requests.OAuth2Requester.submitSync(OAuth2Requester.java:95)
    at com.jagrosh.jdautilities.oauth2.requests.OAuth2Action.complete(OAuth2Action.java:150)

I think a fix would just be to change line 191 from obj.getInt("permissions"))); to obj.getLong("permissions"))); as it returns a value of 556302458433

https://github.com/Chew/JDA-Chewtils/blob/3afd8c83d5c1de7c2b0808253ce6c9c7fd0ae196/oauth2/src/main/java/com/jagrosh/jdautilities/oauth2/entities/impl/OAuth2ClientImpl.java#L177-L195

Chew commented 2 years ago

Try the latest 2.0-SNAPSHOT? Changed ints to longs but might be a breaking change so it'll get shoved into the snapshots for now.

HeyBanditoz commented 2 years ago

It seems to have worked, thanks!

Can't really test the rest, just playing around with OAuth2 for the first time.

On 2/2/2022 01:30, Olivia wrote:

Try the latest 2.0-SNAPSHOT? Changed ints to longs but might be a breaking change so it'll get shoved into the snapshots for now.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

Chew commented 2 years ago

Coolio, lemme know if you run into anything else 😄