check if LibreTranslate is running, add README

This commit is contained in:
Syping 2024-02-22 03:00:38 +01:00
parent f24b50ceae
commit 0c3e973a09
2 changed files with 20 additions and 1 deletions

16
README.md Normal file
View file

@ -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)

View file

@ -1,8 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import json import json
import requests
import os import os
import requests
import subprocess import subprocess
import sys import sys
import time import time
@ -33,6 +33,9 @@ def main():
while True: while True:
try: 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) r = requests.get("http://127.0.0.1:5000/languages", timeout=5)
if r.status_code == 200: if r.status_code == 200:
break; break;