# File contrib/plugins/stats.rb, line 136def handle_stats(m)
ifnot m.private?
total = 0
tokens = @channels[m.target]
hsh = tokens[m.params]
if hsh
sorted = hsh.sort { |i, j| j[1] <=> i[1] }
sorted.each { |a|
total += a[1]
}
msg = "Stats for #{m.params}. Said #{total} times. The top sayers are "
if sorted[0..2]
msg << "#{sorted[0].join ':'}" if sorted[0]
msg << ", #{sorted[1].join ':'}" if sorted[1]
msg << ", and #{sorted[2].join ':'}" if sorted[2]
msg << "."else
msg << "#{m.params} has not been said yet!"
end
@bot.action m.replyto, msg
else
m.reply "#{m.params} is not currently being tracked."
endendend