2011-11-20 10:23:31 +01:00
|
|
|
import random
|
2014-02-14 04:36:57 +01:00
|
|
|
|
2013-09-04 12:30:04 +02:00
|
|
|
from util import hook, text
|
2011-11-20 10:23:31 +01:00
|
|
|
|
2014-02-14 04:36:57 +01:00
|
|
|
|
2012-06-06 02:09:19 +02:00
|
|
|
color_codes = {
|
|
|
|
"<r>": "\x02\x0305",
|
|
|
|
"<g>": "\x02\x0303",
|
|
|
|
"<y>": "\x02"
|
|
|
|
}
|
2011-11-20 10:23:31 +01:00
|
|
|
|
2012-06-06 02:09:19 +02:00
|
|
|
with open("plugins/data/8ball_responses.txt") as f:
|
2012-09-12 01:30:46 +02:00
|
|
|
responses = [line.strip() for line in
|
2013-09-04 12:30:04 +02:00
|
|
|
f.readlines() if not line.startswith("//")]
|
2011-11-20 10:23:31 +01:00
|
|
|
|
2012-02-29 06:09:40 +01:00
|
|
|
|
2011-11-20 10:23:31 +01:00
|
|
|
@hook.command('8ball')
|
2014-02-13 02:34:50 +01:00
|
|
|
def eightball(inp, action=None):
|
2013-09-04 12:30:04 +02:00
|
|
|
"""8ball <question> -- The all knowing magic eight ball,
|
|
|
|
in electronic form. Ask and it shall be answered!"""
|
2012-06-06 02:09:19 +02:00
|
|
|
|
2013-08-02 02:05:44 +02:00
|
|
|
magic = text.multiword_replace(random.choice(responses), color_codes)
|
2013-10-01 04:41:54 +02:00
|
|
|
action("shakes the magic 8 ball... {}".format(magic))
|