made slap use the new TextGenerator class

This commit is contained in:
Luke Rogers 2013-09-12 22:46:43 +12:00
parent 15e7825125
commit 2be0c46b89
6 changed files with 93 additions and 75 deletions

View file

@ -5,14 +5,6 @@ with open("plugins/data/larts.txt") as f:
larts = [line.strip() for line in f.readlines()
if not line.startswith("//")]
with open("plugins/data/slaps.txt") as f:
slaps = [line.strip() for line in f.readlines()
if not line.startswith("//")]
with open("plugins/data/slap_items.txt") as f:
items = [line.strip() for line in f.readlines()
if not line.startswith("//")]
with open("plugins/data/kills.txt") as f:
kills = [line.strip() for line in f.readlines()
if not line.startswith("//")]
@ -25,27 +17,6 @@ with open("plugins/data/flirts.txt") as f:
flirts = [line.strip() for line in f.readlines()
if not line.startswith("//")]
@hook.command
def slap(inp, me=None, nick=None, conn=None, notice=None):
"""slap <user> -- Makes the bot slap <user>."""
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.lower() == conn.nick.lower() or target.lower() == "itself":
target = nick
values = {"item": random.choice(items), "user": target}
phrase = random.choice(slaps)
# act out the message
me(phrase.format(**values))
@hook.command
def lart(inp, me=None, nick=None, conn=None, notice=None):
"""lart <user> -- LARTs <user>."""