Add save command in prompt, fixed issue #28

This commit is contained in:
Némunaire 2013-03-20 09:56:12 +01:00
parent aced38a44b
commit cec57b69ed
2 changed files with 15 additions and 0 deletions

View File

@ -133,6 +133,20 @@ def join(data, toks, context, prompt):
srv.leave(toks[rd]) srv.leave(toks[rd])
return return
def save_mod(data, toks, context, prompt):
"""Force save module data"""
if len(toks) < 2:
print ("save: not enough arguments.")
return
for mod in toks[1:]:
if mod in context.modules:
context.modules[mod].save()
print ("save: module `%s´ saved successfully" % mod)
else:
print ("save: no module named `%s´" % mod)
return
def send(data, toks, context, prompt): def send(data, toks, context, prompt):
"""Send a message on a channel""" """Send a message on a channel"""
rd = 1 rd = 1

View File

@ -8,6 +8,7 @@
<command name="join" call="join" /> <command name="join" call="join" />
<command name="leave" call="join" /> <command name="leave" call="join" />
<command name="part" call="join" /> <command name="part" call="join" />
<command name="save" call="save_mod" />
<command name="send" call="send" /> <command name="send" call="send" />
<command name="zap" call="zap" /> <command name="zap" call="zap" />
</nemubotmodule> </nemubotmodule>