]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
hangman: ensure 'hangman define' always answers
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 29 Jul 2010 12:20:48 +0000 (14:20 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 29 Jul 2010 12:20:48 +0000 (14:20 +0200)
data/rbot/plugins/games/hangman.rb

index 5cef596ee9f594730677da870f52fef03ddb6307..d3c4d20a22811c36692a6cf65ffb371710148d9a 100644 (file)
@@ -479,8 +479,13 @@ class HangmanPlugin < Plugin
 
   def define(m, params)
     if game = @games.previous(m.replyto)
-      return unless res = Google.define(game.word)
-      m.reply "#{Bold}#{game.word}#{Bold} -- #{res}"
+      if res = Google.define(game.word)
+        m.reply "#{Bold}#{game.word}#{Bold} -- #{res}"
+      else
+        m.reply _("looks like google has no definition for %{word}") % { :word => game.word }
+      end
+    else
+      m.reply _("no hangman game was played here recently, what do you want me to define?")
     end
   end
 end