]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
hangman: fix score fetching to work for offline users.
authorSpencer Rinehart <anubis@overthemonkey.com>
Fri, 27 Feb 2009 01:27:55 +0000 (20:27 -0500)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 27 Feb 2009 21:57:42 +0000 (22:57 +0100)
m.server.get_user doesn't work for offline users so use what was given
instead.

data/rbot/plugins/games/hangman.rb

index af0d9d9cddb78e14e4da49b8a05077e55a0afa8e..d571fd782d4fc204a10feceb0aff7a32b74c8625 100644 (file)
@@ -441,18 +441,18 @@ class HangmanPlugin < Plugin
     else
       return unless m.public?
 
-      user  = m.server.get_user(params[:nick])
-      stats = @stats.player_stats(target)[user]
+      nick = params[:nick]
+      stats = @stats.player_stats(target)[nick]
 
       unless stats.played.zero?
         m.reply _("%{nick} has %{score} points after %{games} games") % {
-          :nick  => user.nick,
+          :nick  => nick,
           :score => stats.score.round,
           :games => stats.played
         }
       else
         m.reply _("%{nick} hasn't played hangman :(") % {
-          :nick => user.nick
+          :nick => nick
         }
       end
     end
@@ -491,4 +491,4 @@ plugin.map "hangman stop", :action => 'stop'
 
 plugin.map "hangman score [:nick]", :action => 'score'
 plugin.map "hangman stats", :action => 'stats'
-plugin.map "define", :action => 'define'
\ No newline at end of file
+plugin.map "define", :action => 'define'