mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2025-01-13 20:11:24 +01:00
Add placeholder support to presence updater
This commit is contained in:
parent
d6c1d22b64
commit
7e5f1b5a79
@ -18,6 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.configurate.annotation.Constants;
|
||||
import com.discordsrv.common.core.logging.Logger;
|
||||
import net.dv8tion.jda.api.OnlineStatus;
|
||||
@ -75,7 +76,7 @@ public class PresenceUpdaterConfig {
|
||||
})
|
||||
public String activity = "playing Minecraft";
|
||||
|
||||
public Activity activity(Logger logger) {
|
||||
public Activity activity(Logger logger, DiscordSRV discordSRV) {
|
||||
Activity.ActivityType activityType = Activity.ActivityType.CUSTOM_STATUS;
|
||||
String activity = this.activity;
|
||||
String url = null;
|
||||
@ -115,7 +116,11 @@ public class PresenceUpdaterConfig {
|
||||
break;
|
||||
}
|
||||
|
||||
return Activity.of(activityType, activity, url);
|
||||
return Activity.of(
|
||||
activityType,
|
||||
discordSRV.placeholderService().replacePlaceholders(activity),
|
||||
url
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class PresenceUpdaterModule extends AbstractModule<DiscordSRV> {
|
||||
|
||||
// Log problems with presences
|
||||
for (PresenceUpdaterConfig.Presence presence : discordSRV.config().presenceUpdater.presences) {
|
||||
presence.activity(logger());
|
||||
presence.activity(logger(), discordSRV);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public class PresenceUpdaterModule extends AbstractModule<DiscordSRV> {
|
||||
// Guess not
|
||||
return;
|
||||
}
|
||||
jda.getPresence().setPresence(config.status, config.activity(null));
|
||||
jda.getPresence().setPresence(config.status, config.activity(null, discordSRV));
|
||||
}
|
||||
|
||||
private void setPresenceOrSchedule() {
|
||||
|
Loading…
Reference in New Issue
Block a user