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