2011-11-20 10:23:31 +01:00
|
|
|
from util import hook
|
|
|
|
import re
|
|
|
|
import random
|
|
|
|
|
2012-04-16 04:12:32 +02:00
|
|
|
nick_re = re.compile(r"^[A-Za-z0-9_|\.\-\]\[]*$")
|
2012-03-12 21:41:01 +01:00
|
|
|
|
2011-11-20 10:23:31 +01:00
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
with open("plugins/data/insults.txt") as f:
|
2012-05-09 21:58:28 +02:00
|
|
|
insults = [line.strip() for line in f.readlines()
|
|
|
|
if not line.startswith("//")]
|
2012-02-29 08:31:42 +01:00
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
with open("plugins/data/flirts.txt") as f:
|
2012-05-09 21:58:28 +02:00
|
|
|
flirts = [line.strip() for line in f.readlines()
|
|
|
|
if not line.startswith("//")]
|
2012-04-01 01:01:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
@hook.command
|
|
|
|
def insult(inp, nick=None, me=None, conn=None):
|
2012-05-16 05:07:27 +02:00
|
|
|
"insult <user> -- Makes the bot insult <user>."
|
2012-04-01 01:01:23 +02:00
|
|
|
target = inp.strip()
|
2012-03-12 21:41:01 +01:00
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
if not re.match(nick_re, target):
|
2012-03-12 21:41:01 +01:00
|
|
|
notice("Invalid username!")
|
|
|
|
return
|
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
if target == conn.nick.lower() or target == "itself":
|
2012-03-12 21:41:01 +01:00
|
|
|
target = nick
|
2012-04-01 01:01:23 +02:00
|
|
|
else:
|
|
|
|
target = inp
|
2012-04-02 18:17:55 +02:00
|
|
|
|
2012-04-01 13:56:44 +02:00
|
|
|
out = 'insults %s... "%s"' % (target, random.choice(insults))
|
2012-04-01 01:01:23 +02:00
|
|
|
me(out)
|
2012-03-12 21:41:01 +01:00
|
|
|
|
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
@hook.command
|
|
|
|
def flirt(inp, nick=None, me=None, conn=None):
|
2012-05-16 05:07:27 +02:00
|
|
|
"flirt <user> -- Make the bot flirt with <user>."
|
2012-04-01 01:01:23 +02:00
|
|
|
target = inp.strip()
|
2012-03-06 05:53:45 +01:00
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
if not re.match(nick_re, target):
|
2012-03-06 05:53:45 +01:00
|
|
|
notice("Invalid username!")
|
|
|
|
return
|
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
if target == conn.nick.lower() or target == "itself":
|
|
|
|
target = 'itself'
|
|
|
|
else:
|
2012-03-06 05:53:45 +01:00
|
|
|
target = inp
|
2012-04-02 18:17:55 +02:00
|
|
|
|
2012-04-03 22:58:15 +02:00
|
|
|
out = 'flirts with %s... "%s"' % (target, random.choice(flirts))
|
2012-04-01 01:01:23 +02:00
|
|
|
me(out)
|