Moved the colour code to only run when first loading the plugin
This commit is contained in:
parent
d27185913f
commit
ce53be53d2
1 changed files with 5 additions and 4 deletions
|
@ -8,6 +8,8 @@ color_codes = {
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("plugins/data/8ball_responses.txt") as f:
|
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()
|
responses = [line.strip() for line in f.readlines()
|
||||||
if not line.startswith("//")]
|
if not line.startswith("//")]
|
||||||
|
|
||||||
|
@ -17,7 +19,6 @@ def eightball(input, me=None):
|
||||||
"8ball <question> -- The all knowing magic eight ball, " \
|
"8ball <question> -- The all knowing magic eight ball, " \
|
||||||
"in electronic form. Ask and it shall be answered!"
|
"in electronic form. Ask and it shall be answered!"
|
||||||
|
|
||||||
out = random.choice(responses)
|
# here we use voodoo magic to tell the future
|
||||||
for code in color_codes:
|
magic = random.choice(responses)
|
||||||
out = out.replace(code, color_codes[code])
|
me("shakes the magic 8 ball... %s" % magic)
|
||||||
me("shakes the magic 8 ball... %s" % out)
|
|
||||||
|
|
Reference in a new issue