import random from util import hook, text color_codes = { "": "\x02\x0305", "": "\x02\x0303", "": "\x02" } with open("./data/8ball_responses.txt") as f: responses = [line.strip() for line in f.readlines() if not line.startswith("//")] @hook.command() def eightball(input, conn): """8ball -- The all knowing magic eight ball, in electronic form. Ask and it shall be answered!""" magic = text.multiword_replace(random.choice(responses), color_codes) input.action("shakes the magic 8 ball... {}".format(magic))