diff --git a/README.md b/README.md index 67ce14f..eaa5305 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ discord.js library to interact with Discord and fetches server stats via the XML ## Running the Bot -### Option 1: Run Inside a Docker Container +### Option 1: Run Inside a Docker Container (Recommended) 1. Navigate to the root directory of the cloned repository. 2. Build and start the container: diff --git a/docker-compose.yml b/docker-compose.yml index 3b7cb60..d347e58 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,4 +8,20 @@ services: container_name: ls25bot restart: always volumes: - - ./config.json:/app/config.json \ No newline at end of file + - ./config.json:/app/config.json + + restart: + image: docker:cli + restart: unless-stopped + container_name: ls25bot-restart + volumes: + - /var/run/docker.sock:/var/run/docker.sock + entrypoint: [ "/bin/sh","-c" ] + command: + - | + echo "Restarting ls25bot container is running" + while true; do + sleep 7200 # Each 2 hours + echo "Restarting ls25bot container at $(date)" + docker restart ls25bot + done \ No newline at end of file diff --git a/source/Main.ts b/source/Main.ts index fb91b94..dbae6bb 100644 --- a/source/Main.ts +++ b/source/Main.ts @@ -38,7 +38,7 @@ discordClient.login(appConfig.discord.botToken).then(() => { /** * Start the DiscordService and restart it if an error occurred */ -function startDiscordService(): void { +async function startDiscordService(): Promise { try { new DiscordService(discordClient); } catch (exception) {