fix autocloseable executors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-09 11:30:59 +01:00
parent f523e6cd92
commit 04d93dd7a5
3 changed files with 12 additions and 4 deletions

View File

@@ -187,8 +187,10 @@ public class HidekoBot
// update slash commands (delayed)
final boolean finalForceUpdateCommands = forceUpdateCommands;
Executors.newSingleThreadScheduledExecutor().schedule(() -> // todo: try-with-resources
CommandUtil.updateSlashCommands(finalForceUpdateCommands), 1, TimeUnit.SECONDS);
try (ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor()) {
executor.schedule(() -> CommandUtil.updateSlashCommands(finalForceUpdateCommands),
1, TimeUnit.SECONDS);
}
// set the bot's status
jda.getPresence().setStatus(OnlineStatus.ONLINE);