diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-16 01:06:41 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-16 01:06:41 +0000 |
commit | 71e16adb8a62a78fc1e8cdcc6776b6cd84fbe758 (patch) | |
tree | f26f4c5fafa0fc64387954ad429684490ceb2e31 /rbot/plugins | |
parent | acbb15e9cd1d29406bec5cd41b8cebf909f55f19 (diff) |
added karmastats to the karma plugin
Diffstat (limited to 'rbot/plugins')
-rw-r--r-- | rbot/plugins/karma.rb | 11 |
1 files changed, 11 insertions, 0 deletions
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") |