More refactoring
This commit is contained in:
parent
18b90a2b2a
commit
69775a0cc7
2 changed files with 45 additions and 37 deletions
|
@ -7,6 +7,6 @@ launches a <item> in <who>'s general direction.
|
||||||
sits on <who>'s face, while slamming a <item> into their crotch.
|
sits on <who>'s face, while slamming a <item> into their crotch.
|
||||||
holds <who> down and repeatedly whacks them with a <item>.
|
holds <who> down and repeatedly whacks them with a <item>.
|
||||||
prods <who> with a flaming <item>.
|
prods <who> with a flaming <item>.
|
||||||
picks up a <item>, and whacks <who> with it.
|
picks up a <item> and whacks <who> with it.
|
||||||
ties <who> to a chair and throws a <item> at them.
|
ties <who> to a chair and throws a <item> at them.
|
||||||
hits <who> on the head with a <item>.
|
hits <who> on the head with a <item>.
|
||||||
|
|
|
@ -11,13 +11,13 @@ with open("plugins/data/slaps.txt") as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.startswith("//"):
|
if line.startswith("//"):
|
||||||
continue
|
continue
|
||||||
slaps.append(line)
|
slaps.append(line.strip())
|
||||||
|
|
||||||
with open("plugins/data/slap_items.txt") as f:
|
with open("plugins/data/slap_items.txt") as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.startswith("//"):
|
if line.startswith("//"):
|
||||||
continue
|
continue
|
||||||
slap_items.append(line)
|
slap_items.append(line.strip())
|
||||||
|
|
||||||
larts = ["swaps <who>'s shampoo with glue.",
|
larts = ["swaps <who>'s shampoo with glue.",
|
||||||
"installs Windows on <who>'s computer.",
|
"installs Windows on <who>'s computer.",
|
||||||
|
@ -160,55 +160,63 @@ body = ['head',
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def slap(inp, me=None, nick=None, input=None, notice=None):
|
def slap(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
".slap <user> -- Makes the bot slap <user>."
|
".slap <user> -- Makes the bot slap <user>."
|
||||||
inp = inp.strip()
|
target = inp.lower()
|
||||||
|
|
||||||
if not re.match(nick_re, inp.lower()):
|
if not re.match(nick_re, target):
|
||||||
notice("Invalid username!")
|
notice("Invalid username!")
|
||||||
return
|
return
|
||||||
|
|
||||||
if inp == input.conn.nick.lower() or inp == "itself":
|
# if the user is trying to make the bot slap itself, slap them
|
||||||
target = re.sub ('<who>', nick, random.choice(slaps))
|
if target == conn.nick.lower() or target == "itself":
|
||||||
else:
|
|
||||||
target = re.sub ('<who>', inp, random.choice(slaps))
|
|
||||||
msg = re.sub ('<item>', random.choice(slap_items), target)
|
|
||||||
me(msg)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def lart(inp, me=None, nick=None, input=None, notice=None):
|
|
||||||
".lart <user> -- Makes the bot LART <user>."
|
|
||||||
inp = inp.strip()
|
|
||||||
|
|
||||||
if not re.match(nick_re, inp.lower()):
|
|
||||||
notice("Invalid username!")
|
|
||||||
return
|
|
||||||
|
|
||||||
if inp == input.conn.nick.lower() or inp == "itself":
|
|
||||||
target = nick
|
target = nick
|
||||||
else:
|
else:
|
||||||
target = inp
|
target = inp
|
||||||
msg = re.sub ('<who>', target, random.choice(larts))
|
|
||||||
me(msg)
|
out = random.choice(slaps)
|
||||||
|
out = out.replace('<who>', target)
|
||||||
|
out = out.replace('<item>', random.choice(slap_items))
|
||||||
|
|
||||||
|
# act out the message
|
||||||
|
me(out)
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def kill(inp, me=None, nick=None, input=None, notice=None):
|
def lart(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
|
".lart <user> -- LARTs <user>."
|
||||||
|
target = inp.lower()
|
||||||
|
|
||||||
|
if not re.match(nick_re, target):
|
||||||
|
notice("Invalid username!")
|
||||||
|
return
|
||||||
|
|
||||||
|
if target == conn.nick.lower() or target == "itself":
|
||||||
|
target = nick
|
||||||
|
else:
|
||||||
|
target = inp
|
||||||
|
|
||||||
|
out = random.choice(larts)
|
||||||
|
out = out.replace('<who>', target)
|
||||||
|
out = out.replace('<item>', random.choice(slap_items))
|
||||||
|
me(out)
|
||||||
|
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def kill(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
".kill <user> -- Makes the bot kill <user>."
|
".kill <user> -- Makes the bot kill <user>."
|
||||||
inp = inp.strip()
|
target = inp.lower()
|
||||||
|
|
||||||
if not re.match(nick_re, inp.lower()):
|
if not re.match(nick_re, target):
|
||||||
notice("Invalid username!")
|
notice("Invalid username!")
|
||||||
return
|
return
|
||||||
|
|
||||||
if inp == input.conn.nick.lower() or inp == "itself":
|
if target == conn.nick.lower() or target == "itself":
|
||||||
target = nick
|
target = nick
|
||||||
else:
|
else:
|
||||||
target = inp
|
target = inp
|
||||||
msg = random.choice(kills)
|
|
||||||
msg = re.sub ('<who>', target, msg)
|
out = random.choice(kills)
|
||||||
msg = re.sub ('<body>', random.choice(body), msg)
|
out = out.replace('<who>', target)
|
||||||
me(msg)
|
out = out.replace('<body>', random.choice(body))
|
||||||
|
me(out)
|
||||||
|
|
Reference in a new issue