made 8ball.py use data/, and refactored it slightly (unused imports)
This commit is contained in:
parent
7f381012d5
commit
90af9c0979
2 changed files with 40 additions and 32 deletions
|
@ -1,41 +1,23 @@
|
|||
from util import hook
|
||||
import random
|
||||
import re
|
||||
|
||||
r = "\x02\x0305" # red
|
||||
g = "\x02\x0303" # green
|
||||
y = "\x02" # yellow (not really)
|
||||
color_codes = {
|
||||
"<r>": "\x02\x0305",
|
||||
"<g>": "\x02\x0303",
|
||||
"<y>": "\x02"
|
||||
}
|
||||
|
||||
answers = [g + "As I see it, yes",
|
||||
g + "It is certain",
|
||||
g + "It is decidedly so",
|
||||
g + "Most likely",
|
||||
g + "Outlook good",
|
||||
g + "Signs point to yes",
|
||||
g + "One would be wise to think so",
|
||||
g + "Naturally",
|
||||
g + "Without a doubt",
|
||||
g + "Yes",
|
||||
g + "Yes, definitely",
|
||||
g + "You may rely on it",
|
||||
y + "Reply hazy, try again",
|
||||
y + "Ask again later",
|
||||
y + "Better not tell you now",
|
||||
y + "Cannot predict now",
|
||||
y + "Concentrate and ask again",
|
||||
y + "You know the answer better than I",
|
||||
y + "Maybe...",
|
||||
r + "You're kidding, right?",
|
||||
r + "Don't count on it",
|
||||
r + "In your dreams",
|
||||
r + "My reply is no",
|
||||
r + "My sources say no",
|
||||
r + "Outlook not so good",
|
||||
r + "Very doubtful"]
|
||||
with open("plugins/data/8ball_responses.txt") as f:
|
||||
responses = [line.strip() for line in f.readlines()
|
||||
if not line.startswith("//")]
|
||||
|
||||
|
||||
@hook.command('8ball')
|
||||
def eightball(inp, me=None):
|
||||
def eightball(input, me=None):
|
||||
"8ball <question> -- The all knowing magic eight ball, " \
|
||||
"in electronic form. Ask and it shall be answered!"
|
||||
me("shakes the magic 8 ball... %s" % (random.choice(answers)))
|
||||
|
||||
out = random.choice(responses)
|
||||
for code in color_codes:
|
||||
out = out.replace(code, color_codes[code])
|
||||
me("shakes the magic 8 ball... %s" % out)
|
||||
|
|
26
plugins/data/8ball_responses.txt
Normal file
26
plugins/data/8ball_responses.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
<g>As I see it, yes
|
||||
<g>It is certain
|
||||
<g>It is decidedly so
|
||||
<g>Most likely
|
||||
<g>Outlook good
|
||||
<g>Signs point to yes
|
||||
<g>One would be wise to think so
|
||||
<g>Naturally
|
||||
<g>Without a doubt
|
||||
<g>Yes
|
||||
<g>Yes, definitely
|
||||
<g>You may rely on it
|
||||
<y>Reply hazy, try again
|
||||
<y>Ask again later
|
||||
<y>Better not tell you now
|
||||
<y>Cannot predict now
|
||||
<y>Concentrate and ask again
|
||||
<y>You know the answer better than I
|
||||
<y>Maybe...
|
||||
<r>You're kidding, right?
|
||||
<r>Don't count on it
|
||||
<r>In your dreams
|
||||
<r>My reply is no
|
||||
<r>My sources say no
|
||||
<r>Outlook not so good
|
||||
<r>Very doubtful
|
Reference in a new issue