diff --git a/plugins/8ball.py b/plugins/8ball.py index 3d9385b..6aeea04 100755 --- a/plugins/8ball.py +++ b/plugins/8ball.py @@ -1,41 +1,23 @@ from util import hook import random -import re -r = "\x02\x0305" # red -g = "\x02\x0303" # green -y = "\x02" # yellow (not really) +color_codes = { + "": "\x02\x0305", + "": "\x02\x0303", + "": "\x02" +} -answers = [g + "As I see it, yes", - g + "It is certain", - g + "It is decidedly so", - g + "Most likely", - g + "Outlook good", - g + "Signs point to yes", - g + "One would be wise to think so", - g + "Naturally", - g + "Without a doubt", - g + "Yes", - g + "Yes, definitely", - g + "You may rely on it", - y + "Reply hazy, try again", - y + "Ask again later", - y + "Better not tell you now", - y + "Cannot predict now", - y + "Concentrate and ask again", - y + "You know the answer better than I", - y + "Maybe...", - r + "You're kidding, right?", - r + "Don't count on it", - r + "In your dreams", - r + "My reply is no", - r + "My sources say no", - r + "Outlook not so good", - r + "Very doubtful"] +with open("plugins/data/8ball_responses.txt") as f: + responses = [line.strip() for line in f.readlines() + if not line.startswith("//")] @hook.command('8ball') -def eightball(inp, me=None): +def eightball(input, me=None): "8ball -- The all knowing magic eight ball, " \ "in electronic form. Ask and it shall be answered!" - me("shakes the magic 8 ball... %s" % (random.choice(answers))) + + out = random.choice(responses) + for code in color_codes: + out = out.replace(code, color_codes[code]) + me("shakes the magic 8 ball... %s" % out) diff --git a/plugins/data/8ball_responses.txt b/plugins/data/8ball_responses.txt new file mode 100644 index 0000000..87c7d6b --- /dev/null +++ b/plugins/data/8ball_responses.txt @@ -0,0 +1,26 @@ +As I see it, yes +It is certain +It is decidedly so +Most likely +Outlook good +Signs point to yes +One would be wise to think so +Naturally +Without a doubt +Yes +Yes, definitely +You may rely on it +Reply hazy, try again +Ask again later +Better not tell you now +Cannot predict now +Concentrate and ask again +You know the answer better than I +Maybe... +You're kidding, right? +Don't count on it +In your dreams +My reply is no +My sources say no +Outlook not so good +Very doubtful