from util import hook import re import random slaps = ["slaps with a ", "slaps around a bit with a ", "throws a at ", "grabs a and throws it in 's face", "holds down and repeatedly whacks them with a ", "prods with a flaming ", "picks up a , and whacks with it", "ties to a chair and throws a at them", "hits on the head with a "] items = ["cast iron skillet", "large trout", "baseball bat", "wooden cane", "CRT monitor", "physics textbook", "television", "mau5 head", "five tonn truck", "roll of duct tape", "book", "rubber chicken", "gold block", "fire extinguisher", "heavy rock", "chunk of dirt"] @hook.command def slap(inp, me=None, nick=None, input=None, notice=None): ".slap -- Makes the bot slap ." inp = inp.strip() if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()): notice("Invalid username!") return if inp == input.conn.nick.lower() or inp == "itself": slap = random.choice(slaps) slap = re.sub ('', nick, slap) msg = re.sub ('', random.choice(items), slap) else: slap = random.choice(slaps) slap = re.sub ('', inp, slap) msg = re.sub ('', random.choice(items), slap) me(msg)