You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
6 years ago
|
from json import load, dump, loads
|
||
6 years ago
|
|
||
6 years ago
|
from utils.loaders.command_loader import loadCommands
|
||
|
from utils.logging.log import *
|
||
|
|
||
|
configPath = "conf/"
|
||
|
certPath = "cert/"
|
||
|
|
||
|
filemap = {
|
||
|
"config": ["config.json", "configuration"],
|
||
|
"keyconf": ["keyword.json", "keyword lists"],
|
||
|
"pool": ["pool.json", "pool"],
|
||
|
"help": ["help.json", "command help"],
|
||
|
"wholist": ["wholist.json", "WHO lists"],
|
||
6 years ago
|
"counters": ["counters.json", "counters file"],
|
||
6 years ago
|
"masterbuf": ["masterbuf.json", "master buffer"],
|
||
6 years ago
|
}
|
||
|
|
||
|
connections = {}
|
||
|
IRCPool = {}
|
||
|
ReactorPool = {}
|
||
|
FactoryPool = {}
|
||
|
|
||
|
MonitorPool = []
|
||
|
|
||
|
CommandMap = {}
|
||
|
|
||
|
def register(command, function):
|
||
|
if not command in CommandMap:
|
||
|
CommandMap[command] = function
|
||
6 years ago
|
debug("Registered command: %s" % command)
|
||
6 years ago
|
else:
|
||
|
error("Duplicate command: %s" % (command))
|
||
|
|
||
|
def saveConf(var):
|
||
|
with open(configPath+filemap[var][0], "w") as f:
|
||
|
dump(globals()[var], f, indent=4)
|
||
|
return
|
||
|
|
||
|
def loadConf(var):
|
||
|
with open(configPath+filemap[var][0], "r") as f:
|
||
|
globals()[var] = load(f)
|
||
|
|
||
|
def initConf():
|
||
|
for i in filemap.keys():
|
||
|
loadConf(i)
|
||
|
|
||
|
def initMain():
|
||
|
initConf()
|
||
|
loadCommands(register)
|