Skip to content

Commit

Permalink
Only override Activity when non-null (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre601 committed Jun 4, 2021
1 parent b7c424f commit 232c870
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public CommandClientBuilder setEmojis(String success, String warning, String err

/**
* Sets the {@link net.dv8tion.jda.api.entities.Activity Game} to use when the bot is ready.
* <br>Can be set to {@code null} for no activity.
* <br>Can be set to {@code null} for JDA Utilities to not set it.
*
* @param activity
* The Game to use when the bot is ready
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,10 @@ private void onReady(ReadyEvent event)
return;
}
textPrefix = prefix.equals(DEFAULT_PREFIX) ? "@"+event.getJDA().getSelfUser().getName()+" " : prefix;
event.getJDA().getPresence().setPresence(status==null ? OnlineStatus.ONLINE : status,
activity ==null ? null : "default".equals(activity.getName()) ? Activity.playing("Type "+textPrefix+helpWord) : activity);

if(activity != null)
event.getJDA().getPresence().setPresence(status==null ? OnlineStatus.ONLINE : status,
"default".equals(activity.getName()) ? Activity.playing("Type "+textPrefix+helpWord) : activity);

// Start SettingsManager if necessary
GuildSettingsManager<?> manager = getSettingsManager();
Expand Down

0 comments on commit 232c870

Please sign in to comment.