New slap command, I will update the rest later
This commit is contained in:
parent
3b5fe6f4bb
commit
ae9d3cdd30
1 changed files with 7 additions and 9 deletions
|
@ -29,24 +29,22 @@ with open("plugins/data/kill_bodyparts.txt") as f:
|
||||||
@hook.command
|
@hook.command
|
||||||
def slap(inp, me=None, nick=None, conn=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>."
|
||||||
target = inp.lower()
|
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
target = inp.strip()
|
||||||
|
|
||||||
|
if " " in target:
|
||||||
notice("Invalid username!")
|
notice("Invalid username!")
|
||||||
return
|
return
|
||||||
|
|
||||||
# if the user is trying to make the bot slap itself, slap them
|
# if the user is trying to make the bot slap itself, slap them
|
||||||
if target == conn.nick.lower() or target == "itself":
|
if target.lower() == conn.nick.lower() or target.lower() == "itself":
|
||||||
target = nick
|
target = nick
|
||||||
else:
|
|
||||||
target = inp
|
|
||||||
|
|
||||||
out = random.choice(slaps)
|
values = {"item": random.choice(items), "user": target}
|
||||||
out = out.replace('<who>', target)
|
phrase = random.choice(slaps)
|
||||||
out = out.replace('<item>', random.choice(items))
|
|
||||||
|
|
||||||
# act out the message
|
# act out the message
|
||||||
me(out)
|
me(phrase.format(**values))
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
|
|
Reference in a new issue