Pretend badwords list is zero-indexed
This commit is contained in:
parent
73a33633e2
commit
85f86f9d8a
1 changed files with 2 additions and 1 deletions
|
@ -9,7 +9,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
:require_mode: o
|
:require_mode: o
|
||||||
"""
|
"""
|
||||||
badwords = event["target"].get_setting("badwords", [])
|
badwords = event["target"].get_setting("badwords", [])
|
||||||
badwords = ("(%d) %s" % (i, badword["pattern"]) for i, badword in
|
badwords = ("(%d) %s" % (i+1, badword["pattern"]) for i, badword in
|
||||||
enumerate(badwords))
|
enumerate(badwords))
|
||||||
event["stdout"].write("%s: %s" % (event["target"].name,
|
event["stdout"].write("%s: %s" % (event["target"].name,
|
||||||
", ".join(badwords)))
|
", ".join(badwords)))
|
||||||
|
@ -51,6 +51,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
if index_int >= len(badwords):
|
if index_int >= len(badwords):
|
||||||
raise utils.EventError("%s: unknown badwords index %s" % (
|
raise utils.EventError("%s: unknown badwords index %s" % (
|
||||||
event["user"].nickname, index))
|
event["user"].nickname, index))
|
||||||
|
|
||||||
badwords.pop(index_int)
|
badwords.pop(index_int)
|
||||||
event["target"].set_setting("badwords", badwords)
|
event["target"].set_setting("badwords", badwords)
|
||||||
event["stdout"].write("%s: removed from badwords" %
|
event["stdout"].write("%s: removed from badwords" %
|
||||||
|
|
Loading…
Reference in a new issue