added help for Karma module

This commit is contained in:
Mike Bloy 2011-01-08 23:21:36 -06:00
parent 07d3775842
commit d68487de95

View File

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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"