From 0c3e973a092585733b0c24fd6a909fd139c182a7 Mon Sep 17 00:00:00 2001
From: Syping <syping@syping.de>
Date: Thu, 22 Feb 2024 03:00:38 +0100
Subject: [PATCH] check if LibreTranslate is running, add README

---
 README.md            | 16 ++++++++++++++++
 dtranslatebot-ltd.py |  5 ++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 README.md

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..55c6bf8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+## dtranslatebot
+Open Source Discord Translation Bot
+
+- Translate incoming channel messages to a Webhook
+- Support configuration through slashcommands and JSON
+- Cross-Platform
+
+#### Database Location
+``/root/dtranslatebot/db``
+
+#### How To Run
+```bash
+docker run -d --name=dtranslatebot-ltd docker.io/syping/dtranslatebot-ltd $DISCORD_BOT_TOKEN
+```
+
+GitHub: [dtranslatebot](https://github.com/Syping/dtranslatebot), [dtranslatebot-container](https://github.com/Syping/dtranslatebot-container)
diff --git a/dtranslatebot-ltd.py b/dtranslatebot-ltd.py
index 74153bb..0379654 100755
--- a/dtranslatebot-ltd.py
+++ b/dtranslatebot-ltd.py
@@ -1,8 +1,8 @@
 #!/usr/bin/python3
 # -*- coding: utf-8 -*-
 import json
-import requests
 import os
+import requests
 import subprocess
 import sys
 import time
@@ -33,6 +33,9 @@ def main():
 
     while True:
         try:
+            if lt.poll():
+                print("[Error] LibreTranslate is not running")
+                return lt.returncode
             r = requests.get("http://127.0.0.1:5000/languages", timeout=5)
             if r.status_code == 200:
                 break;