Moved the colour code to only run when first loading the plugin

This commit is contained in:
Luke Rogers 2012-06-08 11:42:30 +12:00
parent d27185913f
commit ce53be53d2

View file

@ -8,6 +8,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("//")]
@ -17,7 +19,6 @@ def eightball(input, me=None):
"8ball <question> -- The all knowing magic eight ball, " \
"in electronic form. Ask and it shall be answered!"
out = random.choice(responses)
for code in color_codes:
out = out.replace(code, color_codes[code])
me("shakes the magic 8 ball... %s" % out)
# here we use voodoo magic to tell the future
magic = random.choice(responses)
me("shakes the magic 8 ball... %s" % magic)