Praxis_Bot/utilities_script.py
2021-01-21 09:26:34 -05:00

59 lines
1.7 KiB
Python

from asyncio.tasks import sleep
import os
import sys
import psutil
import subprocess
import platform
import time
import config as config
import art
clearScreen = lambda: os.system('cls' if os.name == 'nt' else 'clear')
def get_args(text: str) -> list:
return text.split(" ")
def hard_shutdown():
current_system_pid = os.getpid()
ThisSystem = psutil.Process(current_system_pid)
ThisSystem.terminate()
def restart_self():
#current_system_pid = os.getpid()
#os.startfile("python C:/praxis/main.py")
#subprocess.run("python C:/praxis/main.py")
#subprocess.call("python main.py", shell=True)
if platform.system() == 'Windows':
os.system('start cmd /k python main.py')
hard_shutdown()
if platform.system() == 'Linux':
os.system('xfce4-terminal -e "python main.py"')
hard_shutdown()
#os.system('python twitch_script.py')
#os.system('python discord_script.py')
def restart_target():
pass
def launch_target(inputScript: str):
cmd = "start cmd /k python " + inputScript
os.system(cmd)
def splashScreen():
if not config.skip_splashScreenClear:
clearScreen()
art.tprint("----------",font="slant")
art.tprint("Praxis Bot",font="graffiti")
art.tprint("----------",font="slant")
print("-Maintained by Alex Orid The Curious Nerd\nFor help vist discord.gg/thecuriousnerd")
for x in range(0, 5):
print("")
if not config.skip_splashScreenSleep:
time.sleep(3)
if __name__ == "__main__":
#pass
restart_self()