LunarWatcher / Hailey

Multi-purpose Discord moderation bot written in Java/Kotlin
MIT License
0 stars 0 forks source link

Auto-update from Git #2

Open LunarWatcher opened 6 years ago

LunarWatcher commented 6 years ago

It would be nice if the bot auto-updated when there's a tag/commit (not sure which yet) is made on GitHub.

The actually tricky part here is getting it to refresh itself. Because if limitations, however, this would require two jars to be sensible to do. It's that way easier in i.e. Python, because it doesn't require compiling.

Fortunately, the bot uses Gradle, which also has a fatjar function. gradlew fatJar (./gradlew fatJar on *UNIX) is all that's needed. The version in Gradle currently stays constant, which means this is a possibility (UNIX though):

cp build/libs/haileybot-1.0.jar haileybot.jar

This is pretty much standard across all operating systems:

java -jar haileybot-1.0.jar

Java (or Kotlin) might not even be the best language to implement this in, because the launcher would be compiled separately from the main program (the weakness of compiled languages, unfortunately). Another option would be creating the jar with a different argument, but I'm not sure if this plays well while it's running. So this might need to be done in a different language (alternatively bash/batch/etc)

Jenna1337 commented 4 years ago

You mean like this? https://github.com/Jenna3715/DashboardGUI/blob/master/src/dashboard/AutoUpdater.java