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/eightball.py

24 lines
596 B
Python
Raw Normal View History

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
color_codes = {
"<r>": "\x02\x0305",
"<g>": "\x02\x0303",
"<y>": "\x02"
}
2011-11-20 10:23:31 +01:00
with open("plugins/data/8ball_responses.txt") as f:
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!"""
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))