Class: Cinch::Plugins::Eightball

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/8ball.rb

Constant Summary collapse

@@eightball =
[
  "It is certain",
  "It is decidedly so",
  "Without a doubt",
  "Yes - definitely",
  "You may rely on it",
  "As I see it, yes",
  "Most likely",
  "Outlook good",
  "Signs point to yes",
  "Yes",
  "Reply hazy, try again",
  "Ask again later",
  "Better not tell you now",
  "Cannot predict now",
  "Concentrate and ask again",
  "Don't count on it",
  "My reply is no",
  "My sources say no",
  "Outlook not so good",
  "Very doubtful"
]

Instance Method Summary collapse

Instance Method Details

#execute(m, s) ⇒ Object


41
42
43
44
45
46
47
48
49
50
# File 'lib/cinch/plugins/8ball.rb', line 41

def execute(m, s)
  questions = s.split("? ")
  answers = [];
  questions.each {|question|
    question[0] = question[0].upcase
    answers << "\"#{question.delete("?")}?\" #{shake!}"
  }
  output = answers.join(". ") + "."
  m.safe_reply output, true
end

#shake!Object


36
37
38
# File 'lib/cinch/plugins/8ball.rb', line 36

def shake!
  @@eightball.sample
end