-
-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Invite to match Discord changes #2500
base: master
Are you sure you want to change the base?
Update Invite to match Discord changes #2500
Conversation
Discord made all the properties here except for uses accessible without authentication
Update docs to remove the expansion requirement
uses
field require expansion
Could you please link the appropriate Discord API docs PR/commit that documents this change? |
There doesn't seem to be any docs changes, noticed the changes after exceptions were thrown when trying to resolve guild invites Probably should have opened a GH Issue but thought it was redundant |
Looks like there is still a compilation issue here with the constructor usage. Have you tested whether the usage of |
from what I recall the |
Should compile now, missed an internal usage |
Gonna hold off on merging this, still waiting for some info regarding the API stability here. |
I've been told that the changes to expanding invites will need to be reverted. The API will not continue to return the expanded object on the resolve endpoint in the future. |
Seems like Discord. I'll check after they revert the changes and see if there's anything left. |
Change to max_age field noted here: discord/discord-api-docs#6233 |
I've gone ahead and converted this PR into a draft, until it has been adjusted. If you don't want to continue working on it, feel free to close it and open an issue instead. |
src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/requests/restaction/InviteAction.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/requests/restaction/InviteAction.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java
Outdated
Show resolved
Hide resolved
@@ -67,14 +69,23 @@ public InviteActionImpl deadline(long timestamp) | |||
return (InviteActionImpl) super.deadline(timestamp); | |||
} | |||
|
|||
@Override | |||
public boolean isRestricted() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name "restricted" is too vague for what it represents
src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java
Show resolved
Hide resolved
Co-authored-by: Florian Spieß <[email protected]>
* @throws java.lang.IllegalStateException | ||
* if this is not an expanded invite | ||
* @return The max uses of this invite or {@code 0} if there is no limit | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs changes here seem unrelated to the rest of this PR, please revert them.
@@ -312,13 +316,12 @@ default String getUrl() | |||
/** | |||
* Whether this Invite grants only temporary access or not. | |||
* | |||
* <p>This works only for expanded invites and will throw a {@link IllegalStateException} otherwise! | |||
* <p>This works only for expanded invites and will throw a {@link IllegalStateException} otherwise!</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <p>This works only for expanded invites and will throw a {@link IllegalStateException} otherwise!</p> | |
* <p>This works only for expanded invites and will throw a {@link IllegalStateException} otherwise! |
/** | ||
* The maximum age, 30 days, in seconds, for a restricted invite. | ||
* | ||
* <p>A restricted invite is an invite that is created in a non-community server</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <p>A restricted invite is an invite that is created in a non-community server</p> | |
* <p>A restricted invite is an invite that is created in a non-community server |
* | ||
* @see #MAX_RESTRICTED_AGE | ||
*/ | ||
boolean hasCommunityRestrictions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing @return
docs
/** | ||
* Sets the max age in seconds for the invite. Set this to {@code 0} if the invite should never expire. Default is {@code 86400} (24 hours). | ||
* {@code null} will reset this to the default value. | ||
* | ||
* <p>Invites in non-community servers are not allowed to be permanent, with an allowed range of {@code 1} (1 second) to {@code 2592000} (30 days). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <p>Invites in non-community servers are not allowed to be permanent, with an allowed range of {@code 1} (1 second) to {@code 2592000} (30 days). | |
* <p>Invites in {@link #hasCommunityRestrictions() non-community} servers are not allowed to be permanent, with an allowed range of {@code 1} (1 second) to {@code 2592000} (30 days). |
if (nonCommunityRestricted) | ||
{ | ||
Checks.check(maxAge != null && maxAge >= 1 && maxAge <= MAX_RESTRICTED_AGE, | ||
"maxAge for invites in non-community guilds must be between 1 second and 30 days!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"maxAge for invites in non-community guilds must be between 1 second and 30 days!"); | |
"The maximum age for invites in non-community guilds must be between 1 second and 30 days!"); |
Also, the API Docs say 7 days is the maximum, are the docs wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like they haven't merged the API doc changes yet? Not sure if the changes are live
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line changes the docs value from 7 days to 30 days, but hasn't been merged yet
Pull Request Etiquette
Changes
Closes Issue: NaN
Description
Discord made all the previous expanded Invite properties (max_uses, temporary, creation, etc...) except for uses accessible without authentication, so remove the expanded property and deprecate usages
Additionally, update docs to remove the outdated notice that certain fields require expansion
Adds a new method getTimeExpires to return the
expires_at
field of an invite, which is null if the invite never expiresAdd the
FRIEND
InviteType and a way to parse itChange
EntityBuilder
to use the type id to determine invite type