chiark / gitweb /
remove debugging prints, and correct handling of http in channel
authorMatthew Vernon <matthew@rapun.sel.cam.ac.uk>
Tue, 25 May 2010 15:07:06 +0000 (16:07 +0100)
committerMatthew Vernon <matthew@rapun.sel.cam.ac.uk>
Tue, 25 May 2010 15:07:06 +0000 (16:07 +0100)
Servus-chiark.py

index 51c4bbc..3fb7adc 100644 (file)
@@ -163,13 +163,11 @@ urlre = re.compile("(https?://[^ ]+)( |$)")
 urlcomplaints = [" contemporary","n interesting"," fascinating","n overused"," vastly overused"]
 
 def urlq(bot, cmd, nick, conn, public):
-  print "debug: ",bot,cmd,nick,conn,public
   if (not urlre.search(cmd)):
     bot.automsg(False,nick,"Please use 'url' only with http URLs")
     return
 
   url="".join(cmd.split(" ")[1:])
-  print "##",url,"##"
 
   url=canonical_url(url)
   if (url in urldb):
@@ -184,16 +182,13 @@ def urlq(bot, cmd, nick, conn, public):
     else:
       conn.privmsg(bot.channel,"%s would like to draw your attention to %s"%(nick,url))
     urldb[url]=[[nick,time.time()]]
-  print [bot, cmd, nick, conn]
 
 def dourl(bot,conn,nick,command):
   urlstring=urlre.search(command).group(1)
-  print "dourl: ",urlstring
   urlstring=canonical_url(urlstring)
 
   if urlstring in urldb:
     T=urldb[urlstring]
-    print T
     uci = len(T)
     if uci >= len(urlcomplaints):
       uci = len(urlcomplaints)
@@ -261,7 +256,7 @@ def command(bot, cmd, nick, conn, public):
            command=""
 
     if public:
-      if cmd.find("http") != -1:
+      if urlre.search(cmd):
         dourl(bot,conn,nick,cmd)
          
     # karma: up