mirror of
https://github.com/bytedream/untisbot-discord.git
synced 2025-05-09 20:25:09 +02:00
Update rich presence only gets displayed if a major update was released
This commit is contained in:
parent
2de12fbbbf
commit
2bb7834e13
@ -53,6 +53,7 @@ public class Discord {
|
||||
* @since 1.1
|
||||
*/
|
||||
private void updateRichPresence() {
|
||||
if (Main.version.replace(".", "").length() == Main.version.length() - 1) { // only gets executed on major updates
|
||||
try {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/ByteDream/untisbot-discord/releases/tags/v" + Main.version).openConnection();
|
||||
connection.connect();
|
||||
@ -66,9 +67,9 @@ public class Discord {
|
||||
|
||||
if (ChronoUnit.DAYS.between(now, releaseDateTime) == 0) {
|
||||
if (jda != null) {
|
||||
jda.getPresence().setActivity(Activity.playing("update " + Main.version + " („\\(^_^)/“)"));
|
||||
jda.getPresence().setActivity(Activity.playing("update " + Main.version + " \uD83C\uDF89"));
|
||||
} else {
|
||||
jdaBuilder.setActivity(Activity.playing("update " + Main.version + " („\\(^_^)/“)"));
|
||||
jdaBuilder.setActivity(Activity.playing("update " + Main.version + " \uD83C\uDF89"));
|
||||
}
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
@ -86,6 +87,7 @@ public class Discord {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the bot
|
||||
|
Loading…
x
Reference in New Issue
Block a user