Skip to content

Commit

Permalink
Add getPrivacyPolicyUrl() and getTermsOfServiceUrl() to ApplicationIn…
Browse files Browse the repository at this point in the history
…fo (#1882)
  • Loading branch information
Yashar256 committed Nov 7, 2021
1 parent 6548f7a commit 59e9cda
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ public interface ApplicationInfo extends ISnowflake
@Nonnull
String getDescription();

/**
* The URL for the application's terms of service.
*
* @return The URL for the application's terms of service or {@code null} if none is set
*/
@Nullable
String getTermsOfServiceUrl();

/**
* The URL for the application's privacy policy.
*
* @return The URL for the application's privacy policy or {@code null} if none is set
*/
@Nullable
String getPrivacyPolicyUrl();

/**
* The icon id of the bot's application.
* <br>The application icon is <b>not</b> necessarily the same as the bot's avatar!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ public class ApplicationInfoImpl implements ApplicationInfo
private final long id;
private final String iconId;
private final String description;
private final String termsOfServiceUrl;
private final String privacyPolicyUrl;
private final String name;
private final User owner;
private final ApplicationTeam team;
private String scopes = "bot";

public ApplicationInfoImpl(JDA api, String description, boolean doesBotRequireCodeGrant, String iconId, long id,
boolean isBotPublic, String name, User owner, ApplicationTeam team)
boolean isBotPublic, String name, String termsOfServiceUrl, String privacyPolicyUrl, User owner, ApplicationTeam team)
{
this.api = api;
this.description = description;
Expand All @@ -50,6 +52,8 @@ public ApplicationInfoImpl(JDA api, String description, boolean doesBotRequireCo
this.id = id;
this.isBotPublic = isBotPublic;
this.name = name;
this.termsOfServiceUrl = termsOfServiceUrl;
this.privacyPolicyUrl = privacyPolicyUrl;
this.owner = owner;
this.team = team;
}
Expand All @@ -73,6 +77,18 @@ public String getDescription()
return this.description;
}

@Override
public String getTermsOfServiceUrl()
{
return this.termsOfServiceUrl;
}

@Override
public String getPrivacyPolicyUrl()
{
return this.privacyPolicyUrl;
}

@Override
public String getIconId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,8 @@ public Template createTemplate(DataObject object)
public ApplicationInfo createApplicationInfo(DataObject object)
{
final String description = object.getString("description");
final String termsOfServiceUrl = object.getString("terms_of_service_url", null);
final String privacyPolicyUrl = object.getString("privacy_policy_url", null);
final boolean doesBotRequireCodeGrant = object.getBoolean("bot_require_code_grant");
final String iconId = object.getString("icon", null);
final long id = object.getLong("id");
Expand All @@ -1915,7 +1917,8 @@ public ApplicationInfo createApplicationInfo(DataObject object)
final User owner = createUser(object.getObject("owner"));
final ApplicationTeam team = !object.isNull("team") ? createApplicationTeam(object.getObject("team")) : null;

return new ApplicationInfoImpl(getJDA(), description, doesBotRequireCodeGrant, iconId, id, isBotPublic, name, owner, team);
return new ApplicationInfoImpl(getJDA(), description, doesBotRequireCodeGrant, iconId, id, isBotPublic, name,
termsOfServiceUrl, privacyPolicyUrl, owner, team);
}

public ApplicationTeam createApplicationTeam(DataObject object)
Expand Down

0 comments on commit 59e9cda

Please sign in to comment.