Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Conversation

@jagrosh
Copy link
Member

@jagrosh jagrosh commented Feb 7, 2018

No description provided.

@Shengaero Shengaero added this to the Version 2.2 milestone Feb 7, 2018
CURRENT_USER("/users/@me"),
CURRENT_USER_GUILDS("/users/@me/guilds");
// We always use the same rest version as JDA
public static final String BASE_API_URL = String.format("https://discordapp.com/api/v%d", JDAInfo.DISCORD_REST_VERSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dangerous as JDA's rest version can change without notice

@Shengaero Shengaero added Enhancement Modification of existing code-base to enhance quality and/or functionality. Proposal Proposal for a new feature, enhancement, or changes. Version: 2.2 Feature A new and full feature implementation. Requires Testing and removed Proposal Proposal for a new feature, enhancement, or changes. Enhancement Modification of existing code-base to enhance quality and/or functionality. labels Feb 21, 2018
@Shengaero Shengaero changed the title Feature/oauth2 [Feature] OAuth 2 Feb 27, 2018
@Shengaero Shengaero added the Module: OAuth2 Related to the "oauth2" module. label Apr 13, 2018
@duncte123
Copy link
Contributor

Can I volunteer to test this?

{
obj = body.getJSONObject(i);
list.add(new OAuth2GuildImpl(OAuth2ClientImpl.this, obj.getLong("id"),
obj.getString("name"), obj.getString("icon"), obj.getBoolean("owner"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to use obj.optString("icon", nul) because the server icon can be null and it will throw this error:

org.json.JSONException: JSONObject["icon"] not a string.	at org.json.JSONObject.getString(JSONObject.java:810)	at com.jagrosh.jdautilities.oauth2.entities.impl.OAuth2ClientImpl$3.handle(OAuth2ClientImpl.java:185)	at com.jagrosh.jdautilities.oauth2.entities.impl.OAuth2ClientImpl$3.handle(OAuth2ClientImpl.java:165)	at com.jagrosh.jdautilities.oauth2.requests.OAuth2Requester.submitSync(OAuth2Requester.java:95)	at com.jagrosh.jdautilities.oauth2.requests.OAuth2Action.complete(OAuth2Action.java:147) 
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with merge of #67

Thanks for the help @duncte123! 😃

duncte123 and others added 5 commits May 31, 2018 12:07
* Use optString for the guild icon because it can be null * Use null as default
Change file extension of guild icon to reflect jda's change
@duncte123
Copy link
Contributor

duncte123 commented Mar 27, 2019

This branch is currently 100% broken due to discord requiring the params for the token request to be set as post fields instead of get params, will be fixed when #92 is merged

@duncte123
Copy link
Contributor

Since this still has the "needs testing" label I'd like to say that I've been running this branch for a while now in production and it's been working fine, it can be seen in action over here

@jagrosh jagrosh merged commit 17d3cf9 into master Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Feature A new and full feature implementation. Module: OAuth2 Related to the "oauth2" module. Requires Testing Version: 2.2

6 participants