load modules at startup based on config file, remove that item from TODO

This commit is contained in:
Brian S. Stephan 2010-07-29 23:13:15 -05:00
parent 6cc9577570
commit 9191f25052
2 changed files with 12 additions and 7 deletions

1
TODO
View File

@ -6,7 +6,6 @@ dr.botzo --- TODO
* weather module * weather module
* 8ball style module * 8ball style module
* modularizing * modularizing
* select modules to load from config file
* karma v2 * karma v2
* some sort of cron interface (periodic events) * some sort of cron interface (periodic events)
* named pipe to send commands to the bot outside of IRC * named pipe to send commands to the bot outside of IRC

View File

@ -65,12 +65,18 @@ irclib.DEBUG = config.getboolean('IRC', 'debug')
irc = DrBotIRC() irc = DrBotIRC()
server = irc.server().connect(botserver, botport, botnick, botircname) server = irc.server().connect(botserver, botport, botnick, botircname)
count = Countdown.Countdown(config, server, modlist) # load features
dice = Dice.Dice(config, server, modlist) try:
fact = FactFile.FactFile(config, server, modlist) cfgmodlist = config.get('modules', 'modlist')
admin = IrcAdmin.IrcAdmin(config, server, modlist)
gt = GoogleTranslate.GoogleTranslate(config, server, modlist) mods = cfgmodlist.split(',')
seen = Seen.Seen(config, server, modlist) 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 # loop forever
irc.process_forever() irc.process_forever()