Added a graceful shutdown
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
3b33554a86
commit
e1617e3280
@ -19,6 +19,8 @@ public class MovieQuoteBot {
|
|||||||
|
|
||||||
public static final String DISCORD_TOKEN_ENVIRONMENT = "DISCORD_TOKEN";
|
public static final String DISCORD_TOKEN_ENVIRONMENT = "DISCORD_TOKEN";
|
||||||
public static final String PREFIX = "!";
|
public static final String PREFIX = "!";
|
||||||
|
public static final String VERSION = "0.1-SNAPSHOT";
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MovieQuoteBot.class.getCanonicalName());
|
private static final Logger logger = LoggerFactory.getLogger(MovieQuoteBot.class.getCanonicalName());
|
||||||
private static final Map<String, Command> commands = new HashMap<>();
|
private static final Map<String, Command> commands = new HashMap<>();
|
||||||
|
|
||||||
@ -51,6 +53,8 @@ public class MovieQuoteBot {
|
|||||||
.next()))
|
.next()))
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> logger.info("Received shut down signal. Bye!")));
|
||||||
|
|
||||||
client.onDisconnect().block();
|
client.onDisconnect().block();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user