mirror of
https://github.com/cloudmaker97/FS25-Discord-Bot.git
synced 2025-12-06 00:18:34 +00:00
Made the discord service starter async for the node engine and added regularly restarts within docker
This commit is contained in:
parent
e2da4df733
commit
6bf6280a70
3 changed files with 19 additions and 3 deletions
|
|
@ -69,7 +69,7 @@ discord.js library to interact with Discord and fetches server stats via the XML
|
||||||
|
|
||||||
## Running the Bot
|
## 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.
|
1. Navigate to the root directory of the cloned repository.
|
||||||
2. Build and start the container:
|
2. Build and start the container:
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,20 @@ services:
|
||||||
container_name: ls25bot
|
container_name: ls25bot
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/config.json
|
- ./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
|
||||||
|
|
@ -38,7 +38,7 @@ discordClient.login(appConfig.discord.botToken).then(() => {
|
||||||
/**
|
/**
|
||||||
* Start the DiscordService and restart it if an error occurred
|
* Start the DiscordService and restart it if an error occurred
|
||||||
*/
|
*/
|
||||||
function startDiscordService(): void {
|
async function startDiscordService(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
new DiscordService(discordClient);
|
new DiscordService(discordClient);
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue