]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/games/wheelfortune.rb
script plugin: store channels as strings
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / games / wheelfortune.rb
index d873c9e455d3222c335b9e707d52475a9abba169..e0b0930d93528d3d0e6f0295b17307351b267e92 100644 (file)
@@ -9,7 +9,8 @@
 
 # Wheel-of-Fortune Question/Answer
 class WoFQA
-  attr_accessor :cat, :clue, :answer, :hint
+  attr_accessor :cat, :clue, :hint
+  attr_reader :answer
   def initialize(cat, clue, ans=nil)
     @cat = cat # category
     @clue = clue # clue phrase
@@ -226,7 +227,7 @@ class WheelOfFortune < Plugin
   def help(plugin, topic="")
     case topic
     when 'play'
-      _("wof [<channel>] play [<name>] for <single> to <max> => starts a wheel-of-fortune game on channel <channel> (default: current channel), named <name> (default: wheelfortune.game_name config setting, or the last game name used by the user), with <single> points per round. the game is won when a player reachers <max> points. vowerls cost <single>*<single>/<max> points. The user that starts the game is the game manager and must set up the clues and answers in private. All the other users have to learn the answer to each clue by saying single consonants or the whole sentence. Every time a consonant is guessed, the bot will reveal the partial answer, showing the missing letters as * (asterisks).")
+      _("wof [<channel>] play [<name>] for <single> to <max> => starts a wheel-of-fortune game on channel <channel> (default: current channel), named <name> (default: wheelfortune.game_name config setting, or the last game name used by the user), with <single> points per round. the game is won when a player reachers <max> points. vowels cost <single>*<single>/<max> points. The user that starts the game is the game manager and must set up the clues and answers in private. All the other users have to learn the answer to each clue by saying single consonants or the whole sentence. Every time a consonant is guessed, the bot will reveal the partial answer, showing the missing letters as * (asterisks).")
     when 'category', 'clue', 'answer'
       _("wof <channel> [category: <cat>,] clue: <clue>, answer: <ans> => set up a new question for the wheel-of-fortune game being played on channel <channel>. This command must be sent in private by the game manager. The category <cat> can be omitted. If you make mistakes, you can use 'wof replace' (see help) before the question gets asked")
     when 'replace'
@@ -488,7 +489,7 @@ class WheelOfFortune < Plugin
         }
         score_table(m.channel, game)
         @games.delete(ch)
-      else :more
+      else
         m.reply _("%{bold}%{color}%{name}%{bold}, round %{count}%{nocolor} -- score so far:") % {
           :bold => Bold,
           :color => Irc.color(:green),
@@ -505,8 +506,8 @@ class WheelOfFortune < Plugin
     end
   end
 
-  def listen(m)
-    return unless m.kind_of?(PrivMessage) and not m.address?
+  def message(m)
+    return if m.address?
     ch = m.channel.irc_downcase(m.server.casemap).intern
     return unless game = @games[ch]
     return unless game.running?