Don't load modules if we don't have any servers configured

This commit is contained in:
jesopo 2018-11-05 21:39:30 +00:00
parent dccb460e5c
commit 28a00e01de

View file

@ -45,14 +45,17 @@ bot = IRCBot.Bot(directory, args, cache, config, database, events,
whitelist = bot.get_setting("module-whitelist", []) whitelist = bot.get_setting("module-whitelist", [])
blacklist = bot.get_setting("module-blacklist", []) blacklist = bot.get_setting("module-blacklist", [])
server_configs = bot.database.servers.get_all()
if len(server_configs):
modules.load_modules(bot, whitelist=whitelist, blacklist=blacklist) modules.load_modules(bot, whitelist=whitelist, blacklist=blacklist)
servers = [] servers = []
for server_id, alias in bot.database.servers.get_all(): for server_id, alias in server_configs:
server = bot.add_server(server_id, connect=False) server = bot.add_server(server_id, connect=False)
if not server == None: if not server == None:
servers.append(server) servers.append(server)
if len(servers):
bot._events.on("boot.done").call() bot._events.on("boot.done").call()
timers.setup(bot.find_settings_prefix("timer-")) timers.setup(bot.find_settings_prefix("timer-"))