merged feelings.py and violence.py
This commit is contained in:
parent
78173b7f63
commit
d69feb68d8
2 changed files with 44 additions and 50 deletions
44
plugins/violence.py → plugins/attacks.py
Executable file → Normal file
44
plugins/violence.py → plugins/attacks.py
Executable file → Normal file
|
@ -17,6 +17,14 @@ with open("plugins/data/kills.txt") as f:
|
||||||
kills = [line.strip() for line in f.readlines()
|
kills = [line.strip() for line in f.readlines()
|
||||||
if not line.startswith("//")]
|
if not line.startswith("//")]
|
||||||
|
|
||||||
|
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("//")]
|
||||||
|
|
||||||
|
|
||||||
@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):
|
||||||
|
@ -76,3 +84,39 @@ def kill(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
|
|
||||||
# act out the message
|
# act out the message
|
||||||
me(phrase.format(**values))
|
me(phrase.format(**values))
|
||||||
|
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def insult(inp, nick=None, me=None, conn=None, notice=None):
|
||||||
|
"insult <user> -- Makes the bot insult <user>."
|
||||||
|
target = inp.strip()
|
||||||
|
|
||||||
|
if " " in target:
|
||||||
|
notice("Invalid username!")
|
||||||
|
return
|
||||||
|
|
||||||
|
if target == conn.nick.lower() or target == "itself":
|
||||||
|
target = nick
|
||||||
|
else:
|
||||||
|
target = inp
|
||||||
|
|
||||||
|
out = 'insults %s... "%s"' % (target, random.choice(insults))
|
||||||
|
me(out)
|
||||||
|
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def flirt(inp, nick=None, me=None, conn=None, notice=None):
|
||||||
|
"flirt <user> -- Make the bot flirt with <user>."
|
||||||
|
target = inp.strip()
|
||||||
|
|
||||||
|
if " " in target:
|
||||||
|
notice("Invalid username!")
|
||||||
|
return
|
||||||
|
|
||||||
|
if target == conn.nick.lower() or target == "itself":
|
||||||
|
target = 'itself'
|
||||||
|
else:
|
||||||
|
target = inp
|
||||||
|
|
||||||
|
out = 'flirts with %s... "%s"' % (target, random.choice(flirts))
|
||||||
|
me(out)
|
|
@ -1,50 +0,0 @@
|
||||||
from util import hook
|
|
||||||
import re
|
|
||||||
import random
|
|
||||||
|
|
||||||
nick_re = re.compile(r"^[A-Za-z0-9_|\.\-\]\[]*$")
|
|
||||||
|
|
||||||
|
|
||||||
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("//")]
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def insult(inp, nick=None, me=None, conn=None):
|
|
||||||
"insult <user> -- Makes the bot insult <user>."
|
|
||||||
target = inp.strip()
|
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
|
||||||
notice("Invalid username!")
|
|
||||||
return
|
|
||||||
|
|
||||||
if target == conn.nick.lower() or target == "itself":
|
|
||||||
target = nick
|
|
||||||
else:
|
|
||||||
target = inp
|
|
||||||
|
|
||||||
out = 'insults %s... "%s"' % (target, random.choice(insults))
|
|
||||||
me(out)
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def flirt(inp, nick=None, me=None, conn=None):
|
|
||||||
"flirt <user> -- Make the bot flirt with <user>."
|
|
||||||
target = inp.strip()
|
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
|
||||||
notice("Invalid username!")
|
|
||||||
return
|
|
||||||
|
|
||||||
if target == conn.nick.lower() or target == "itself":
|
|
||||||
target = 'itself'
|
|
||||||
else:
|
|
||||||
target = inp
|
|
||||||
|
|
||||||
out = 'flirts with %s... "%s"' % (target, random.choice(flirts))
|
|
||||||
me(out)
|
|
Reference in a new issue