IrcAdmin: following the last change to saving, have !save also call a new save_modules()

This commit is contained in:
Brian S. Stephan 2011-01-08 00:49:10 -06:00
parent 1e0de47d84
commit 3e533890a1
2 changed files with 5 additions and 0 deletions

View File

@ -246,6 +246,10 @@ class DrBotIRC(irclib.IRC):
print(self.save_config())
sys.exit()
def save_modules(self):
for module in self.modlist:
module.save()
def save_config(self):
with open('dr.botzo.cfg', 'w') as cfg:
self.config.write(cfg)

View File

@ -68,6 +68,7 @@ class IrcAdmin(Module):
elif whats[0] == '!autojoin' and admin_unlocked and len(whats) >= 3:
return self.sub_autojoin_manipulate(connection, event, nick, userhost, what, admin_unlocked)
elif whats[0] == '!config' and whats[1] == 'save' and admin_unlocked:
self.irc.save_modules()
return self.irc.save_config()
elif whats[0] == '!nick' and admin_unlocked and len(whats) >= 2:
return self.sub_change_nick(connection, event, nick, userhost, what, admin_unlocked)