Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

BotCommands module - Hot restarter

When you build changes of your code, this modules restarts your app automatically, in the same JVM, leading to much faster restarts, as it doesn't need to recompile most of the code.

Warning

If you are using Spring, use spring-boot-devtools instead.

Installing

BotCommands-restarter on maven central

Maven

<dependencies>
  <dependency>
    <groupId>io.github.freya022</groupId>
    <artifactId>BotCommands-restarter</artifactId>
    <version>VERSION</version>
  </dependency>
</dependencies>

Gradle

repositories {
    mavenCentral()
}

dependencies {
    implementation("io.github.freya022:BotCommands-restarter:VERSION")
}

Snapshots

To use the latest, unreleased changes, see SNAPSHOTS.md.

Usage

You can enable the feature by doing so, after which, every build will restart your application.

Note

You should minimize the amount of code executed before calling BotCommandsRestarter.initialize, as it will run twice on startup, then everytime it is restarted.

Important

You must only use this feature during development, here are a few ways to do so:

  • Using a program argument like --dev then reading it from args
  • Using a configuration file with a IS_DEV property
  • Using an environment variable

Kotlin

fun main(args: Array<out String>) {
    // You should enable this only during development
    @OptIn(ExperimentalRestartApi::class)
    BotCommandsRestarter.initialize(args) {
        // Optional configuration
    }
    
    // ...
    BotCommands.create {
        // ...
    }
}

Java

void main(String[] args) {
    // You should enable this only during development
    BotCommandsRestarter.initialize(args, builder -> {
        // Optional configuration
    });
    
    // ...
    BotCommands.create(config -> {
        // ...
    });
}