diff --git a/plugins/violence.py b/plugins/violence.py index 48ad088..30c3758 100755 --- a/plugins/violence.py +++ b/plugins/violence.py @@ -29,24 +29,22 @@ with open("plugins/data/kill_bodyparts.txt") as f: @hook.command def slap(inp, me=None, nick=None, conn=None, notice=None): "slap -- Makes the bot slap ." - target = inp.lower() - if not re.match(nick_re, target): + target = inp.strip() + + if " " in target: notice("Invalid username!") return # if the user is trying to make the bot slap itself, slap them - if target == conn.nick.lower() or target == "itself": + if target.lower() == conn.nick.lower() or target.lower() == "itself": target = nick - else: - target = inp - out = random.choice(slaps) - out = out.replace('', target) - out = out.replace('', random.choice(items)) + values = {"item": random.choice(items), "user": target} + phrase = random.choice(slaps) # act out the message - me(out) + me(phrase.format(**values)) @hook.command