Create start.py

This commit is contained in:
Poseidon 2024-04-08 15:20:33 +02:00 committed by GitHub
parent 98d756d181
commit fab32dcdf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,32 @@
import subprocess
import asyncio
while True:
try:
import discord
from dotenv import load_dotenv
from pydactyl import PterodactylClient
import pytz
except ImportError as e:
if "discord" in str(e):
print("Module discord is niet gevonden en word nu geinstalleerd")
asyncio.sleep(5)
subprocess.run(["pip", "install", "-U", "py-cord[voice]"])
elif "dotenv" in str(e):
print("Module python-dotenv has not been found and is installing now")
asyncio.sleep(5)
subprocess.run(["pip", "install", "python-dotenv"])
elif "pydactyl" in str(e):
print("Module pydactyl has not been found and is installing now")
asyncio.sleep(5)
subprocess.run(["pip", "install", "py-dactyl"])
elif "pytz" in str(e):
print("Module pytz has not been found and is installing now")
asyncio.sleep(5)
subprocess.run(["pip", "install", "pytz"])
else:
print(f"Unknown Importerror: {e}")
break
else:
subprocess.run(["python", "bot.py"])
break