This commit is contained in:
Luke Rogers 2012-06-12 09:45:23 +12:00
parent 3cab25f123
commit 51bcddd44a
3 changed files with 18 additions and 18 deletions

View file

@ -1,4 +1,5 @@
from util import hook
from util.text import multiword_replace
import random
color_codes = {
@ -8,10 +9,8 @@ color_codes = {
}
with open("plugins/data/8ball_responses.txt") as f:
for code in color_codes:
f = f.replace(code, color_codes[code])
responses = [line.strip() for line in f.readlines()
if not line.startswith("//")]
responses = [multiword_replace(line.strip(), color_codes) for line in
f.readlines()if not line.startswith("//")]
@hook.command('8ball')
@ -19,6 +18,6 @@ def eightball(input, me=None):
"8ball <question> -- The all knowing magic eight ball, " \
"in electronic form. Ask and it shall be answered!"
# here we use voodoo magic to tell the future
# here we use voodoo magic to tell the future
magic = random.choice(responses)
me("shakes the magic 8 ball... %s" % magic)