Update server.py

This commit is contained in:
Nova Cat 2025-01-08 21:53:37 -08:00
parent cc8a70333f
commit 41cb5616e4

View file

@ -25,8 +25,8 @@ ping_timeout = 255
restrict_ip = '' restrict_ip = ''
global banlist global banlist
banlist = {} banlist = {}
global mods global modules
mods = {"sql_provider": None, "command": [], "allsocket": [], "banprovider": None} modules = {"sql_provider": None, "command": [], "allsocket": [], "banprovider": None}
def updateklines(): def updateklines():
global banlist global banlist
try: try:
@ -89,13 +89,11 @@ for i in modules:
print(f"Importing module {i}...") print(f"Importing module {i}...")
temp_module = importlib.import_module(i) temp_module = importlib.import_module(i)
if temp_module.__ircat_type__ == "sql.provider": if temp_module.__ircat_type__ == "sql.provider":
global modules
if modules["sql_provider"] != None: if modules["sql_provider"] != None:
modules["sql_provider"] = temp_module modules["sql_provider"] = temp_module
else: else:
raise Exception(f"Tried to import {i} as an SQL provider, but something's already the SQL provider.") raise Exception(f"Tried to import {i} as an SQL provider, but something's already the SQL provider.")
elif temp_module.__ircat_type__ == "command": elif temp_module.__ircat_type__ == "command":
global modules
modules["command"].append(temp_module) modules["command"].append(temp_module)
except: except:
print(f"Module {i} failed to load.") print(f"Module {i} failed to load.")