From d68487de9529fc83f8afa586fb1e14ac5d8981bd Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sat, 8 Jan 2011 23:21:36 -0600 Subject: [PATCH] added help for Karma module --- modules/Karma.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/modules/Karma.py b/modules/Karma.py index 98269a7..07a85c7 100644 --- a/modules/Karma.py +++ b/modules/Karma.py @@ -18,6 +18,7 @@ along with this program. If not, see . import re import sqlite3 +import string from Module import Module @@ -228,6 +229,43 @@ class Karma(Module): return reply + def help_description(self): + """Return a quick list of commands or other summary, should be + less than two lines. If you want the module hidden from "!help", + return None here""" + return "record karma and report on recorded karma" + + def help_summary(self): + """Return a command summary or longer description of this module. + If this returns None, the summary will be + "no help available for module foo" + """ + return """Watches channels for words (or parenthesized phrases) followed by one of ++, --, +-, or -+, and records an increment, decrement, or combination of karma for the word or phrase, as well as the identity of the karma giver. Supports the following commands: + !rank [item] - get the current karma value for item + !karma stat [nick] - report on the karma-giving statistics of nick + !karma report (highest|lowest) - report on the highest or lowest karma recipients + !karma report (positive|negative) - report on the biggest optimists or pessimists""" + + def help_detail(self, command): + """Return detailed help for the given command. Return None if there + is no suitable help available""" + key = command.strip() + if key[0] == '!': + key = key[1:] + words = key.split() + if len(words) == 0: + return None + elif words[0] == 'rank': + return "!rank [item] - get the current karma value and rank of [item]" + elif words[0] == 'karma': + return """!karma stat [nick] - report on the positive, negative, and total karma given by [nick] +!karma report highest - report on the top 5 karma recipients +!karma report lowest - report on the bottom 5 karma recipients +!karma report positive - report on the 5 most positive karma givers +!karma report negative - report on the 5 most negative karma givers""" + else: + return None + if __name__ == "__main__": print "Hello World"