check for missing depends

This commit is contained in:
WhatDidYouExpect 2025-06-27 19:45:44 +02:00
parent 04b0144281
commit d03fa25c88
3 changed files with 27 additions and 11 deletions

23
bot.py
View file

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

View file

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

View file

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