print version on boot
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.youhavetrouble.noted</groupId>
|
<groupId>me.youhavetrouble.noted</groupId>
|
||||||
<artifactId>Noted</artifactId>
|
<artifactId>Noted</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>21</maven.compiler.source>
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
|||||||
@@ -14,14 +14,28 @@ import java.util.Collections;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
private static final Properties properties = new Properties();
|
private static final Properties properties = new Properties();
|
||||||
|
private static String version = "Unknown version";
|
||||||
public static JDA jda;
|
public static JDA jda;
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
loadProperties();
|
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())
|
jda = JDABuilder.createLight(properties.getProperty("DISCORD_TOKEN"), Collections.emptyList())
|
||||||
.setCallbackPool(Executors.newVirtualThreadPerTaskExecutor())
|
.setCallbackPool(Executors.newVirtualThreadPerTaskExecutor())
|
||||||
.setActivity(Activity.customStatus("Notekeeping..."))
|
.setActivity(Activity.customStatus("Notekeeping..."))
|
||||||
@@ -68,4 +82,8 @@ public class Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user