Skip to content

Commit af7f72d

Browse files
committed
2.0.0-rc3
1 parent a0e672e commit af7f72d

3 files changed

Lines changed: 23 additions & 12 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66

77
application.mainClass = "de.skyking_px.PhoenixBot.Bot"
88
group = "de.skyking_px"
9-
version = "2.0.0-rc2"
9+
version = "2.0.0-rc3"
1010

1111
repositories {
1212
mavenCentral()

src/main/java/de/skyking_px/PhoenixBot/Bot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.io.IOException;
2727

2828
public class Bot {
29-
public static final String VERSION = "2.0.0-rc2";
29+
public static final String VERSION = "2.0.0-rc3";
3030
private static final Logger logger = LoggerFactory.getLogger(Bot.class);
3131

3232
private static VoteStorage voteStorage;

src/main/java/de/skyking_px/PhoenixBot/Listener.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.io.IOException;
1616
import java.time.Instant;
1717
import java.util.Objects;
18+
import java.util.concurrent.TimeUnit;
1819

1920
public class Listener extends ListenerAdapter {
2021
private static final Logger logger = LoggerFactory.getLogger(Bot.class);
@@ -23,29 +24,39 @@ public class Listener extends ListenerAdapter {
2324
@Override
2425
public void onReady(@NotNull ReadyEvent event) {
2526
JDA api = event.getJDA();
26-
api.retrieveCommands().queue(commands -> {
27-
for (Command cmd : commands) {
28-
api.deleteCommandById(cmd.getId()).queue();
29-
}
30-
});
31-
for (Guild guild : api.getGuilds()) {
32-
guild.retrieveCommands().queue(commands -> {
27+
try {
28+
logger.info("[BOT] Resetting Commands...");
29+
api.retrieveCommands().queue(commands -> {
3330
for (Command cmd : commands) {
34-
guild.deleteCommandById(cmd.getId()).queue();
31+
api.deleteCommandById(cmd.getId()).queue();
3532
}
3633
});
34+
TimeUnit.SECONDS.sleep(2);
35+
for (Guild guild : api.getGuilds()) {
36+
guild.retrieveCommands().queue(commands -> {
37+
for (Command cmd : commands) {
38+
guild.deleteCommandById(cmd.getId()).queue();
39+
}
40+
});
41+
}
42+
logger.info("[BOT] Commands were reset.");
43+
} catch (Exception e) {
44+
logger.error("[BOT] An Error occurred while trying to reset commands!", e);
3745
}
38-
logger.info("[BOT] Commands were reset");
39-
logger.info("[BOT] Applying Commands...");
4046
try {
47+
TimeUnit.SECONDS.sleep(10);
48+
logger.info("[BOT] Applying Commands...");
4149
api.updateCommands()
4250
.addCommands(CommandRegistry.regiserCommands())
4351
.queue();
52+
logger.info("[BOT] Commands applied.");
4453
} catch (Exception e) {
4554
logger.error("[BOT] An Error occurred while trying to register commands!", e);
4655
}
4756
try {
57+
logger.info("[BOT] Initializing voting storage...");
4858
Bot.initStorage();
59+
logger.info("[BOT] Voting storage initialized.");
4960
} catch (IOException e) {
5061
logger.error("[BOT] An Error occurred while trying to initialize voting storage!");
5162
}

0 commit comments

Comments
 (0)