chiark / gitweb /
remember to update the count
authorMatthew Vernon <matthew@rapun.sel.cam.ac.uk>
Fri, 4 Jun 2010 19:53:45 +0000 (20:53 +0100)
committerMatthew Vernon <matthew@rapun.sel.cam.ac.uk>
Fri, 4 Jun 2010 19:53:45 +0000 (20:53 +0100)
commands.py

index fb35d4f..fb4175c 100644 (file)
@@ -322,7 +322,7 @@ class UrlLog:
     def firstmen(self):
         return nicetime(time.time()-self.first)
     def urltype(self):
-        z=max(len(urlcomplaints), self.count-1)
+        z=min(len(urlcomplaints)-1, self.count-1)
         return urlcomplaints[z]
         
 urlre = re.compile("(https?://[^ ]+)( |$)")
@@ -343,6 +343,7 @@ def urlq(bot, cmd, nick, conn, public,urldb):
                (T.urltype(),T.firstmen(),T.nick)
     if (public):
       complaint=complaint+". Furthermore it defeats the point of this command to use it other than via /msg."
+      T.count+=1
     bot.automsg(False,nick,complaint)
     T.lastasked=time.time()
   else:
@@ -363,6 +364,7 @@ def dourl(bot,conn,nick,command,urldb):
              (T.urltype(),T.firstmen(),T.nick)
     conn.action(bot.channel, message)
     T.lastseen=time.time()
+    T.count+=1
   else:
     urldb[urlstring]=UrlLog(urlstring,nick)