remember: only allow one replacement

This commit is contained in:
Ryan Hitchman 2014-02-07 11:46:13 -08:00
parent 791df9409d
commit 79fec9ee46
1 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ def get_memory(db, chan, word):
@hook.command("r")
def remember(inp, nick='', chan='', db=None):
".remember <word> [+]<data> s/<before>/<after> -- maps word to data in the memory, or "
" does string replacement (not regex)"
" does a string replacement (not regex)"
db_init(db)
append = False
@ -58,7 +58,7 @@ def remember(inp, nick='', chan='', db=None):
if len(args) == 3:
replacement = True
_, src, dst = args
new_data = _tail.replace(src, dst)
new_data = _tail.replace(src, dst, 1)
if new_data == _tail:
return 'replacement left data unchanged'
tail = new_data