better method of loading modules --- don't import *, import each individually
This commit is contained in:
parent
5a81f4d1fc
commit
da9e4b3142
@ -26,8 +26,6 @@ import sqlite3
|
||||
|
||||
from extlib import irclib
|
||||
|
||||
from modules import *
|
||||
|
||||
modlist = []
|
||||
moduleList = [ "Countdown", "Dice", "IrcAdmin", "GoogleTranslate", "Seen", "FactFile" ]
|
||||
modObjs = []
|
||||
@ -146,8 +144,11 @@ try:
|
||||
mods = cfgmodlist.split(',')
|
||||
for mod in mods:
|
||||
# try to load each module
|
||||
module = eval(mod + '.' + mod + '(config, server, modlist)')
|
||||
module.attach_to_server(server)
|
||||
modstr = 'modules.'+mod
|
||||
__import__(modstr)
|
||||
module = sys.modules[modstr]
|
||||
botmod = eval('module.' + mod + '(config, server, modlist)')
|
||||
botmod.attach_to_server(server)
|
||||
except NoSectionError as e:
|
||||
print("You seem to be missing a modules config section, which you probably wanted.")
|
||||
except NoOptionError as e:
|
||||
|
Loading…
Reference in New Issue
Block a user