print version on boot

This commit is contained in:
2024-08-05 22:35:44 +02:00
parent cc24b59bec
commit 4ff74af795
2 changed files with 19 additions and 1 deletions
@@ -14,14 +14,28 @@ import java.util.Collections;
import java.util.Properties;
import java.util.concurrent.Executors;
public class Main {
private static final Properties properties = new Properties();
private static String version = "Unknown version";
public static JDA jda;
public static void main(String[] args) throws InterruptedException {
loadProperties();
try (InputStream resource = Main.class.getClassLoader().getResourceAsStream("version.txt")) {
if (resource != null) {
version = new String(resource.readAllBytes());
} else {
System.err.println("Version file missing.");
}
} catch (IOException e) {
throw new RuntimeException(e);
}
System.out.println("Starting " + version);
jda = JDABuilder.createLight(properties.getProperty("DISCORD_TOKEN"), Collections.emptyList())
.setCallbackPool(Executors.newVirtualThreadPerTaskExecutor())
.setActivity(Activity.customStatus("Notekeeping..."))
@@ -68,4 +82,8 @@ public class Main {
}
}
public static String getVersion() {
return version;
}
}