From 62a833f29aab2bff38e446c3245e57d90cb631a5 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 11 Apr 2003 21:31:43 +0000 Subject: [PATCH] Added markovfirsts command. --- plugins/Markov.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/Markov.py b/plugins/Markov.py index efbae9d26..5bec6db56 100644 --- a/plugins/Markov.py +++ b/plugins/Markov.py @@ -170,7 +170,7 @@ class Markov(callbacks.Privmsg, ChannelDBHandler): def markovfirsts(self, irc, msg, args): """[] - 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 = 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): + """[] + + Returns the number of Markov's last links in the database for + . + """ + 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