diff --git a/ChangeLog b/ChangeLog index 300be905f..193b5024b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/plugins/Dunno.py b/plugins/Dunno.py index 914d03c08..5ac3a7044 100644 --- a/plugins/Dunno.py +++ b/plugins/Dunno.py @@ -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 ' 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: 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) @@ -208,6 +214,12 @@ class Dunno(callbacks.Privmsg): new_dunno, id) 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])