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

24 lines
652 B
Python
Raw Normal View History

2011-11-20 10:23:31 +01:00
from util import hook
2012-06-11 23:45:23 +02:00
from util.text import multiword_replace
2011-11-20 10:23:31 +01:00
import random
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
2012-06-11 23:45:23 +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')
def eightball(input, me=None):
2012-05-16 05:07:27 +02:00
"8ball <question> -- The all knowing magic eight ball, " \
2012-02-29 06:09:40 +01:00
"in electronic form. Ask and it shall be answered!"
2012-06-11 23:45:23 +02:00
# here we use voodoo magic to tell the future
magic = multiword_replace(random.choice(responses), color_codes)
me("shakes the magic 8 ball... %s" % magic)