This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
CloudBot/plugins/slap.py

51 lines
1.5 KiB
Python
Raw Normal View History

2011-11-20 10:23:31 +01:00
from util import hook
import re
import random
slaps = ["slaps <who> with a <item>",
"slaps <who> around a bit with a <item>",
"throws a <item> at <who>",
"grabs a <item> and throws it in <who>'s face",
"holds <who> down and repeatedly whacks them with a <item>",
"prods <who> with a flaming <item>",
"picks up a <item>, and whacks <who> with it",
"ties <who> to a chair and throws a <item> at them",
"hits <who> on the head with a <item>"]
items = ["cast iron skillet",
"large trout",
"baseball bat",
"wooden cane",
"CRT monitor",
"physics textbook",
"television",
2012-02-29 08:31:42 +01:00
"mau5 head",
"five tonn truck",
2011-11-20 10:23:31 +01:00
"roll of duct tape",
"book",
"rubber chicken",
2012-02-29 08:31:42 +01:00
"gold block",
2011-11-20 10:23:31 +01:00
"fire extinguisher",
"heavy rock",
"chunk of dirt"]
@hook.command
2012-02-29 09:29:53 +01:00
def slap(inp, me=None, nick=None, input=None, notice=None):
2012-02-28 03:03:43 +01:00
".slap <user> -- Makes the bot slap <user>."
2011-11-20 10:23:31 +01:00
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":
2012-02-29 08:31:42 +01:00
slap = random.choice(slaps)
slap = re.sub ('<who>', nick, slap)
msg = re.sub ('<item>', random.choice(items), slap)
2011-11-20 10:23:31 +01:00
else:
slap = random.choice(slaps)
slap = re.sub ('<who>', inp, slap)
msg = re.sub ('<item>', random.choice(items), slap)
me(msg)