Skip to content

Commit

Permalink
Prevent Discord from not updating when state/details are not set Rign…
Browse files Browse the repository at this point in the history
…er#14

Ensure that state and details are not empty strings before adding them to the JSON.
Discord won't update itself if one of them is empty.
  • Loading branch information
echebbi committed Apr 22, 2018
1 parent e04c121 commit 536239b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,12 @@ JsonObject toJson(long pid, long nonce)
args.add("pid", new JsonPrimitive(pid));

JsonObject activity = new JsonObject();
activity.add("state", new JsonPrimitive(this.getState()));
activity.add("details", new JsonPrimitive(this.getDetails()));

if (!this.getState().trim().isEmpty())
activity.add("state", new JsonPrimitive(this.getState()));

if (!this.getDetails().trim().isEmpty())
activity.add("details", new JsonPrimitive(this.getDetails()));

if (this.getStartTimestamp() != 0 || this.getEndTimestamp() != 0)
{
Expand Down

0 comments on commit 536239b

Please sign in to comment.