diff --git a/bot.py b/bot.py index ad51b56..4d65b2e 100644 --- a/bot.py +++ b/bot.py @@ -6,6 +6,16 @@ import random import shutil import traceback import subprocess + + + +from modules.globalvars import * +from modules.prestartchecks import start_checks + +# Print splash text and check for updates +print(splashtext) # Print splash text (from modules/globalvars.py) +start_checks() + import requests import psutil @@ -19,22 +29,19 @@ from nltk.data import find from nltk import download from better_profanity import profanity -from modules.globalvars import * + +from discord.ext import commands, tasks +from discord import app_commands + from modules.central import ping_server from modules.translations import * from modules.markovmemory import * from modules.version import * from modules.sentenceprocessing import * -from modules.prestartchecks import start_checks from modules.unhandledexception import handle_exception from modules.image import gen_image -from discord.ext import commands, tasks -from discord import app_commands -sys.excepthook = handle_exception -# Print splash text and check for updates -print(splashtext) # Print splash text (from modules/globalvars.py) -start_checks() +sys.excepthook = handle_exception check_for_update() # Check for updates (from modules/version.py) launched = False diff --git a/modules/globalvars.py b/modules/globalvars.py index a65da79..bda96cc 100644 --- a/modules/globalvars.py +++ b/modules/globalvars.py @@ -40,5 +40,5 @@ song = os.getenv("song") arch = platform.machine() slash_commands_enabled = False latest_version = "0.0.0" -local_version = "1.0.0" +local_version = "1.0.1" os.environ['gooberlocal_version'] = local_version diff --git a/modules/prestartchecks.py b/modules/prestartchecks.py index 9e0df14..8bd73e0 100644 --- a/modules/prestartchecks.py +++ b/modules/prestartchecks.py @@ -1,10 +1,15 @@ import time import os -import psutil import sys import subprocess import ast -import requests +psutilavaliable = True +try: + import requests + import psutil +except ImportError: + psutilavaliable = False + print("Missing Requests! and Psutil!") import re import importlib.metadata @@ -141,6 +146,8 @@ def check_latency(): print(f"{RED}Error running ping: {e}{RESET}") def check_memory(): + if psutilavaliable == False: + return try: memory_info = psutil.virtual_memory() total_memory = memory_info.total / (1024 ** 3) @@ -160,6 +167,8 @@ def check_memory(): print("psutil is not installed. Memory check skipped.") def check_cpu(): + if psutilavaliable == False: + return print("Measuring CPU usage per core...") cpu_per_core = psutil.cpu_percent(interval=1, percpu=True) for idx, core_usage in enumerate(cpu_per_core):