remember: only allow one replacement
This commit is contained in:
parent
791df9409d
commit
79fec9ee46
|
@ -27,7 +27,7 @@ def get_memory(db, chan, word):
|
||||||
@hook.command("r")
|
@hook.command("r")
|
||||||
def remember(inp, nick='', chan='', db=None):
|
def remember(inp, nick='', chan='', db=None):
|
||||||
".remember <word> [+]<data> s/<before>/<after> -- maps word to data in the memory, or "
|
".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)
|
db_init(db)
|
||||||
|
|
||||||
append = False
|
append = False
|
||||||
|
@ -58,7 +58,7 @@ def remember(inp, nick='', chan='', db=None):
|
||||||
if len(args) == 3:
|
if len(args) == 3:
|
||||||
replacement = True
|
replacement = True
|
||||||
_, src, dst = args
|
_, src, dst = args
|
||||||
new_data = _tail.replace(src, dst)
|
new_data = _tail.replace(src, dst, 1)
|
||||||
if new_data == _tail:
|
if new_data == _tail:
|
||||||
return 'replacement left data unchanged'
|
return 'replacement left data unchanged'
|
||||||
tail = new_data
|
tail = new_data
|
||||||
|
|
Loading…
Reference in New Issue