From 71e16adb8a62a78fc1e8cdcc6776b6cd84fbe758 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Sat, 16 Jul 2005 01:06:41 +0000 Subject: added karmastats to the karma plugin --- rbot/plugins/karma.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'rbot/plugins') diff --git a/rbot/plugins/karma.rb b/rbot/plugins/karma.rb index 44b6d026..1bed175a 100644 --- a/rbot/plugins/karma.rb +++ b/rbot/plugins/karma.rb @@ -56,6 +56,16 @@ class KarmaPlugin < Plugin end end def privmsg(m) + if (m.plugin == "karmastats") + if (@registry.length) + max = @registry.values.max + min = @registry.values.min + best = @registry.to_hash.index(max) + worst = @registry.to_hash.index(min) + m.reply "#{@registry.length} votes. Best: #{best} (#{max}); Worst: #{worst} (#{min})" + return + end + end unless(m.params) m.reply "incorrect usage: " + m.plugin return @@ -73,3 +83,4 @@ class KarmaPlugin < Plugin end plugin = KarmaPlugin.new plugin.register("karma") +plugin.register("karmastats") -- cgit v1.2.3