From fab32dcdf68c9e16fb46051d1f9387d29b06b52f Mon Sep 17 00:00:00 2001 From: Poseidon <62171904+Poseidon281@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:20:33 +0200 Subject: [PATCH] Create start.py --- bots/discord/PterodiscordBot/start.py | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 bots/discord/PterodiscordBot/start.py diff --git a/bots/discord/PterodiscordBot/start.py b/bots/discord/PterodiscordBot/start.py new file mode 100644 index 00000000..af577049 --- /dev/null +++ b/bots/discord/PterodiscordBot/start.py @@ -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