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

57 lines
1.7 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>.",
2012-03-03 23:34:21 +01:00
"chucks a few <item>s at <who>.",
"grabs a <item> and throws it in <who>'s face.",
2012-03-03 23:34:21 +01:00
"launches a <item> in <who>'s general direction.",
"sits on <who>'s face, while slamming a <item> into their crotch.",
"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>."]
2011-11-20 10:23:31 +01:00
items = ["cast iron skillet",
"large trout",
"baseball bat",
"wooden cane",
"CRT monitor",
"diamond sword",
2011-11-20 10:23:31 +01:00
"physics textbook",
"television",
"mau5head",
"five ton truck",
2011-11-20 10:23:31 +01:00
"roll of duct tape",
"book",
"cobblestone block",
"lava bucket",
2011-11-20 10:23:31 +01:00
"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)