Skip to content
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

Add getPrivacyPolicyUrl() and getTermsOfServiceUrl() to ApplicationInfo #1882

Merged
merged 1 commit into from
Nov 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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