chiark / gitweb /
remember to update the count
[irc.git] / commands.py
index fb35d4f075bd19b2168b1ff511f610ffb19f488f..fb4175c2c587a5d09563562513dbe015e97012df 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)