Skip to content

Commit 232c870

Browse files
authored
Only override Activity when non-null (#3)
Implements JDA-Applications#110
1 parent b7c424f commit 232c870

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

command/src/main/java/com/jagrosh/jdautilities/command/CommandClientBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public CommandClientBuilder setEmojis(String success, String warning, String err
274274

275275
/**
276276
* Sets the {@link net.dv8tion.jda.api.entities.Activity Game} to use when the bot is ready.
277-
* <br>Can be set to {@code null} for no activity.
277+
* <br>Can be set to {@code null} for JDA Utilities to not set it.
278278
*
279279
* @param activity
280280
* The Game to use when the bot is ready

command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,10 @@ private void onReady(ReadyEvent event)
490490
return;
491491
}
492492
textPrefix = prefix.equals(DEFAULT_PREFIX) ? "@"+event.getJDA().getSelfUser().getName()+" " : prefix;
493-
event.getJDA().getPresence().setPresence(status==null ? OnlineStatus.ONLINE : status,
494-
activity ==null ? null : "default".equals(activity.getName()) ? Activity.playing("Type "+textPrefix+helpWord) : activity);
493+
494+
if(activity != null)
495+
event.getJDA().getPresence().setPresence(status==null ? OnlineStatus.ONLINE : status,
496+
"default".equals(activity.getName()) ? Activity.playing("Type "+textPrefix+helpWord) : activity);
495497

496498
// Start SettingsManager if necessary
497499
GuildSettingsManager<?> manager = getSettingsManager();

0 commit comments

Comments
 (0)