From 70a075660ba7ba31f997ffaede8e12035ee6388c Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Sun, 25 Oct 2020 17:11:09 +0100 Subject: [PATCH] Implemented a way to check if the discord token is given Signed-off-by: Louis Vallat --- src/main/java/xyz/vallat/louis/MovieQuoteBot.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/xyz/vallat/louis/MovieQuoteBot.java b/src/main/java/xyz/vallat/louis/MovieQuoteBot.java index 7e27662..2c7448f 100644 --- a/src/main/java/xyz/vallat/louis/MovieQuoteBot.java +++ b/src/main/java/xyz/vallat/louis/MovieQuoteBot.java @@ -5,8 +5,14 @@ import org.slf4j.LoggerFactory; public class MovieQuoteBot { + private static final Logger logger = LoggerFactory.getLogger(MovieQuoteBot.class.getCanonicalName()); + public static final String DISCORD_TOKEN_ENVIRONMENT = "DISCORD_TOKEN"; + public static void main(String[] args) { - Logger logger = LoggerFactory.getLogger(MovieQuoteBot.class.getCanonicalName()); + if (System.getenv(DISCORD_TOKEN_ENVIRONMENT) == null && args.length == 0) { + logger.error("Missing token. Exiting."); + System.exit(1); + } logger.debug("Hello World!"); }