This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
CloudBot/disabled_stuff/attacks.py

73 lines
1.8 KiB
Python
Raw Normal View History

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