2012-02-28 23:31:42 -08:00
import random
2014-02-14 16:36:57 +13:00
from util import hook
2012-03-26 18:32:20 +13:00
with open ( " plugins/data/larts.txt " ) as f :
2012-05-10 07:54:30 +12:00
larts = [ line . strip ( ) for line in f . readlines ( )
if not line . startswith ( " // " ) ]
2012-03-26 18:32:20 +13:00
2013-08-01 10:36:47 +12:00
with open ( " plugins/data/insults.txt " ) as f :
insults = [ line . strip ( ) for line in f . readlines ( )
if not line . startswith ( " // " ) ]
with open ( " plugins/data/flirts.txt " ) as f :
flirts = [ line . strip ( ) for line in f . readlines ( )
if not line . startswith ( " // " ) ]
2013-11-12 07:06:06 +01:00
2012-02-28 23:31:42 -08:00
@hook.command
2013-10-01 15:41:54 +13:00
def lart ( inp , action = None , nick = None , conn = None , notice = None ) :
2013-09-04 18:30:04 +08:00
""" lart <user> -- LARTs <user>. """
2012-10-18 10:03:17 +13:00
target = inp . strip ( )
2012-02-28 23:31:42 -08:00
2012-10-18 10:03:17 +13:00
if " " in target :
2012-02-28 23:31:42 -08:00
notice ( " Invalid username! " )
return
2012-10-18 10:03:17 +13:00
# if the user is trying to make the bot slap itself, slap them
if target . lower ( ) == conn . nick . lower ( ) or target . lower ( ) == " itself " :
2012-03-05 20:53:45 -08:00
target = nick
2012-04-02 09:17:55 -07:00
2012-10-18 10:03:17 +13:00
values = { " user " : target }
phrase = random . choice ( larts )
# act out the message
2013-10-01 15:41:54 +13:00
action ( phrase . format ( * * values ) )
2012-03-06 10:14:26 -08:00
2013-08-01 10:36:47 +12:00
@hook.command
2013-10-01 15:41:54 +13:00
def insult ( inp , nick = None , action = None , conn = None , notice = None ) :
2013-09-04 18:30:04 +08:00
""" insult <user> -- Makes the bot insult <user>. """
2013-08-01 10:36:47 +12:00
target = inp . strip ( )
if " " in target :
notice ( " Invalid username! " )
return
if target == conn . nick . lower ( ) or target == " itself " :
target = nick
else :
target = inp
2013-09-05 09:46:49 +08:00
out = ' insults {} ... " {} " ' . format ( target , random . choice ( insults ) )
2013-10-01 15:41:54 +13:00
action ( out )
2013-08-01 10:36:47 +12:00
@hook.command
2013-10-01 15:41:54 +13:00
def flirt ( inp , action = None , conn = None , notice = None ) :
2013-09-04 18:30:04 +08:00
""" flirt <user> -- Make the bot flirt with <user>. """
2013-08-01 10:36:47 +12:00
target = inp . strip ( )
if " " in target :
notice ( " Invalid username! " )
return
if target == conn . nick . lower ( ) or target == " itself " :
target = ' itself '
else :
target = inp
2013-09-05 09:46:49 +08:00
out = ' flirts with {} ... " {} " ' . format ( target , random . choice ( flirts ) )
2013-10-01 15:41:54 +13:00
action ( out )