summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorMark Kretschmann <markey@web.de>2006-09-20 07:47:33 +0000
committerMark Kretschmann <markey@web.de>2006-09-20 07:47:33 +0000
commit398935bfe28ac7b7ef3f92a6535b19761267aa81 (patch)
tree63d9452ed945949f4dedab95ed62a72d8f49ee96 /data/rbot
parent324d51450fcddd1355d4677effd42b4c0e2ded9e (diff)
Quiz plugin: Improve error handling.
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/quiz.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/data/rbot/plugins/quiz.rb b/data/rbot/plugins/quiz.rb
index eeef338e..83e6ff92 100644
--- a/data/rbot/plugins/quiz.rb
+++ b/data/rbot/plugins/quiz.rb
@@ -482,8 +482,10 @@ class QuizPlugin < Plugin
def cmd_top5( m, params )
q = create_quiz( m.target.to_s )
-
- debug q.rank_table.inspect
+ if q.rank_table.empty?
+ m.reply "There are no scores known yet!"
+ return
+ end
m.reply "* Top 5 Players for #{m.target.to_s}:"
@@ -500,8 +502,10 @@ class QuizPlugin < Plugin
num = params[:number].to_i
return unless 1..50 === num
q = create_quiz( m.target.to_s )
-
- debug q.rank_table.inspect
+ if q.rank_table.empty?
+ m.reply "There are no scores known yet!"
+ return
+ end
ar = []
m.reply "* Top #{num} Players for #{m.target.to_s}:"
@@ -512,13 +516,7 @@ class QuizPlugin < Plugin
score = player[1].score
ar << "#{i + 1}. #{unhilight_nick( nick )} (#{score})"
end
- str = ar.join(" | ")
-
- if str.empty?
- m.reply "Noone in #{m.target.to_s} has a score!"
- else
- m.reply str
- end
+ m.reply ar.join(" | ")
end