load modules at startup based on config file, remove that item from TODO
This commit is contained in:
parent
6cc9577570
commit
9191f25052
1
TODO
1
TODO
|
@ -6,7 +6,6 @@ dr.botzo --- TODO
|
|||
* weather module
|
||||
* 8ball style module
|
||||
* modularizing
|
||||
* select modules to load from config file
|
||||
* karma v2
|
||||
* some sort of cron interface (periodic events)
|
||||
* named pipe to send commands to the bot outside of IRC
|
||||
|
|
18
dr.botzo.py
18
dr.botzo.py
|
@ -65,12 +65,18 @@ irclib.DEBUG = config.getboolean('IRC', 'debug')
|
|||
irc = DrBotIRC()
|
||||
server = irc.server().connect(botserver, botport, botnick, botircname)
|
||||
|
||||
count = Countdown.Countdown(config, server, modlist)
|
||||
dice = Dice.Dice(config, server, modlist)
|
||||
fact = FactFile.FactFile(config, server, modlist)
|
||||
admin = IrcAdmin.IrcAdmin(config, server, modlist)
|
||||
gt = GoogleTranslate.GoogleTranslate(config, server, modlist)
|
||||
seen = Seen.Seen(config, server, modlist)
|
||||
# load features
|
||||
try:
|
||||
cfgmodlist = config.get('modules', 'modlist')
|
||||
|
||||
mods = cfgmodlist.split(',')
|
||||
for mod in mods:
|
||||
# try to load each module
|
||||
eval(mod + '.' + mod + '(config, server, modlist)')
|
||||
except NoSectionError as e:
|
||||
print("You seem to be missing a modules config section, which you probably wanted.")
|
||||
except NoOptionError as e:
|
||||
print("You seem to be missing a modlist config option, which you probably wanted.")
|
||||
|
||||
# loop forever
|
||||
irc.process_forever()
|
||||
|
|
Loading…
Reference in New Issue