Added markovfirsts command.

This commit is contained in:
Jeremy Fincher 2003-04-11 21:31:43 +00:00
parent 8b0f62220d
commit 62a833f29a

View File

@ -170,7 +170,7 @@ class Markov(callbacks.Privmsg, ChannelDBHandler):
def markovfirsts(self, irc, msg, args):
"""[<channel>]
Returns the number of Markov's chain links in the database for
Returns the number of Markov's first links in the database for
<channel>.
"""
channel = privmsgs.getChannel(msg, args)
@ -195,6 +195,20 @@ class Markov(callbacks.Privmsg, ChannelDBHandler):
s = 'There are %s follows in my Markov database for %s' % (n, channel)
irc.reply(msg, s)
def markovlasts(self, irc, msg, args):
"""[<channel>]
Returns the number of Markov's last links in the database for
<channel>.
"""
channel = privmsgs.getChannel(msg, args)
db = self.getDb(channel)
cursor = db.cursor()
cursor.execute("""SELECT COUNT(*) FROM follows WHERE word=NULL""")
n = cursor.fetchone()[0]
s = 'There are %s follows in my Markov database for %s' % (n, channel)
irc.reply(msg, s)
Class = Markov