command to save the config file without quitting. mostly using for debugging, but probably interesting in general

This commit is contained in:
Brian S. Stephan 2010-07-25 10:09:48 -05:00
parent acaf5e297e
commit 226ad6709e
1 changed files with 13 additions and 0 deletions

View File

@ -97,6 +97,17 @@ def sub_report_seen(connection, event, nick, userhost, replypath, what, admin_un
connection.privmsg(replypath, 'last saw ' + query + ' at ' + converted.strftime("%Y/%m/%d %H:%M:%S") + ' saying \'' + seendata[2] + '\'')
except NoOptionError: pass
#####
# sub_save_config
# save the config file
#####
def sub_save_config(connection, event, nick, userhost, replypath, what, admin_unlocked):
if what.split(' ')[0] == 'save' and admin_unlocked:
with open('dr.botzo.cfg', 'w') as cfg:
config.write(cfg)
connection.privmsg(replypath, 'saved config file')
#####
# on_connect
# handler for when the bot has connected to IRC
@ -140,6 +151,7 @@ def on_privmsg(connection, event):
sub_part_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
sub_quit_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what, admin_unlocked)
sub_save_config(connection, event, nick, userhost, replypath, what, admin_unlocked)
# standard commands
sub_report_seen(connection, event, nick, userhost, replypath, what, admin_unlocked)
@ -178,6 +190,7 @@ def on_pubmsg(connection, event):
sub_part_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
sub_quit_channel(connection, event, nick, userhost, replypath, what, admin_unlocked)
sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what, admin_unlocked)
sub_save_config(connection, event, nick, userhost, replypath, what, admin_unlocked)
# standard commands
sub_report_seen(connection, event, nick, userhost, replypath, what, admin_unlocked)