Added some help and Dunno.stats.

This commit is contained in:
Jeremy Fincher 2004-07-20 05:36:59 +00:00
parent 4a7e2dba20
commit 83e16fa4bb
2 changed files with 25 additions and 8 deletions

View File

@ -1,14 +1,19 @@
* Added Dunno.stats, to return the number of dunnos in the
database.
* Added the Currency plugin, to perform currency conversions.
* Added conf.supybot.plugins.Karma.allowSelfRating, which determines
whether users are allowed to adjust the karma of their current nick.
* Added conf.supybot.plugins.Karma.allowSelfRating, which
determines whether users are allowed to adjust the karma of their
current nick.
* Added --nolimit option to Misc.last, which causes it to return all
matches that are in the history.
* Added --nolimit option to Misc.last, which causes it to return
all matches that are in the history.
* Added conf.supybot.plugins.Herald.defaultHerald, which provides
a default herald to use for unregistered users. Herald.default was
also added as a friendly interface to managing the defaultHerald.
a default herald to use for unregistered users. Herald.default
was also added as a friendly interface to managing the
defaultHerald.
* Added Weather.wunder, which uses wunderground.com to report the
current weather status.

View File

@ -30,8 +30,9 @@
###
"""
The Dunno module is used to spice up the "replyWhenNotCommand" behavior with
random "I dunno"-like responses.
The Dunno module is used to spice up the 'replyWhenNotCommand' behavior with
random 'I dunno'-like responses. If you want something spicier than '<x> is
not a valid command'-like responses, use this plugin.
"""
__revision__ = "$Id$"
@ -56,6 +57,11 @@ except ImportError:
dbfilename = os.path.join(conf.supybot.directories.data(), 'Dunno.db')
class Dunno(callbacks.Privmsg):
"""This plugin was written initially to work with MoobotFactoids, the two
of them to provide a similar-to-moobot-and-blootbot interface for factoids.
Basically, it replaces the standard 'Error: <X> is not a valid command.'
messages with messages kept in a database, able to give more personable
responses."""
priority = 100
def __init__(self):
callbacks.Privmsg.__init__(self)
@ -209,6 +215,12 @@ class Dunno(callbacks.Privmsg):
self.db.commit()
irc.replySuccess()
def stats(self, irc, msg, args):
"""Returns the number of dunnos in the dunno database."""
cursor = self.db.cursor()
cursor.execute("""SELECT COUNT(*) FROM dunnos""")
irc.reply(cursor.fetchone()[0])
Class = Dunno