2011-11-20 10:23:31 +01:00
|
|
|
from util import hook
|
|
|
|
import re
|
|
|
|
import random
|
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
nick_re = re.compile(r"^[A-Za-z0-9_|.-\]\[]*$")
|
2012-03-12 21:41:01 +01:00
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
insults = []
|
|
|
|
flirts = []
|
2011-11-20 10:23:31 +01:00
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
with open("plugins/data/insults.txt") as f:
|
|
|
|
for line in f.readlines():
|
|
|
|
if line.startswith("//"):
|
|
|
|
continue
|
|
|
|
insults.append(line.strip())
|
2012-02-29 08:31:42 +01:00
|
|
|
|
2012-04-01 01:01:23 +02:00
|
|
|
with open("plugins/data/flirts.txt") as f:
|
|
|
|
for line in f.readlines():
|
|
|
|
if line.startswith("//"):
|
|
|
|
continue
|
|
|
|
flirts.append(line.strip())
|
|
|
|
|
|
|
|
|
|
|
|
@hook.command
|
|
|
|
def insult(inp, nick=None, me=None, conn=None):
|
2012-03-12 21:41:01 +01: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
|
|
|
|
out = "insults " + target + "... \"" + random.choice(insults) + "\""
|
|
|
|
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-02-28 03:03:43 +01: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-01 01:01:23 +02:00
|
|
|
out = "flirts with " + target + "... \"" + random.choice(flirts) + "\""
|
|
|
|
me(out)
|