#Botler.py
import os
import sys
import socket
import string
import datetime
import smtplib

HOST = "dot"
PORT = 6667
NICK = "Botler"
IDENT = 'Botler'
REALNAME = 'Botler'
readbuffer = ""
mainchannel = "#hackathon"
readbuffer = ''
s = socket.socket()
print "Connecting to Dot..."

s.connect((HOST, PORT))
s.send("NICK %s\r\n" % NICK)
s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
s.send("JOIN "+mainchannel+"\r\n")
s.send("PRIVMSG %s :Botler is Now Online and Running...\r\n" % mainchannel)
print "Server Running"

def log(message):
		s.send('PRIVMSG ' +mainchannel+' :'+message+'\r\n')

while 1:
		data = s.recv(2048)
		if data.find ('PING') !=-1:
				s.send('PONG' + data.split()[1]+'\r\n') 
		if data.find("hello") !=-1:
				log("Hello! May I invite you to bite my shiny virtual ass?")
							



@@ -1,108 +1,92 @@
 #
-Botler.py%0Aimport os%0Aimport sys%0Aimport socket%0Aimport string%0Aimport datetime%0Aimport smtplib%0A%0AHOST = %22dot%22
+!/usr/bin/env python3%0A%0A# botler: the CCoWMU IRC bot.%0A%0Aimport socket%0A%0AHOST = 'localhost'
 %0APOR
@@ -102,17 +102,17 @@
 NICK = %22
-B
+b
 otler%22%0AI
@@ -115,25 +115,25 @@
 r%22%0AIDENT = '
-B
+b
 otler'%0AREALN
@@ -143,74 +143,328 @@
  = '
-B
+b
 otler'%0A
-readbuffer = %22%22%0Amainchannel = %22#hackathon%22%0Areadbuffer = ''
+LEADER = '%25'%0ASTART_CHANNELS = %5B'#hackathon'%5D%0A%0Adef send(message):%0A    # TODO: break message up based on maximum message size%0A    s.send('%7B%7D%5Cr%5Cn'.format(message))%0A%0Adef recv():%0A    # TODO: buffer until one line%0A    return s.recv(2048)%0A%0Adef say(channel, message):%0A    send('PRIVMSG %7B%7D :%7B%7D'.format(channel, message))%0A
 %0As =
@@ -485,18 +485,18 @@
 ()%0Aprint
- %22
+('
 Connecti
@@ -505,15 +505,46 @@
  to 
-Dot...%22
+%7B%7D:%7B%7D as %7B%7D'.format(HOST, PORT, NICK))
 %0A%0As.
@@ -569,71 +569,69 @@
 T))%0A
-s.
 send(
-%22
+'
 NICK 
-%25s%5Cr%5Cn%22 %25 
+%7B%7D'.format(
 NICK)
+)
 %0A
-s.
 send(
-%22
+'
 USER 
-%25s %25s
+%7B%7D %7B%7D
  bla :
-%25s%5Cr%5Cn%22 %25 
+%7B%7D'.format
 (IDE
@@ -655,45 +655,79 @@
 E))%0A
-s.
+for channel in START_CHANNELS:%0A    
 send(
-%22
+'
 JOIN 
-%22+mainchannel+%22%5Cr%5Cn%22)%0As.
+%7B%7D'.format(channel))%0A    
 send
@@ -740,10 +740,10 @@
 MSG 
-%25s
+%7B%7D
  :Bo
@@ -779,28 +779,25 @@
 g...
-%5Cr%5Cn%22 %25 main
+%22.format(
 channel)
 %0Apri
@@ -796,102 +796,26 @@
 nel)
+)
 %0Aprint
- %22Server Running%22%0A%0Adef log(message):%0A%09%09s.send('PRIVMSG ' +mainchannel+' :'+message+'%5Cr%5Cn
+('Connected
 ')%0A%0A
@@ -827,32 +827,65 @@
  1:%0A
-%09%09
+    
 data = 
-s.
 recv(
-2048)%0A%09%09
+)%0A    # TODO: parse message properly%0A    
 if d
@@ -892,17 +892,16 @@
 ata.find
- 
 ('PING')
@@ -907,18 +907,21 @@
 ) !=
+ 
 -1:%0A
-%09%09%09%09s.
+        
 send
@@ -930,12 +930,20 @@
 PONG
-' + 
+ %7B%7D'.format(
 data
@@ -957,20 +957,16 @@
 )%5B1%5D
-+'%5Cr%5Cn') %0A%09%09
+)) %0A    
 if d
@@ -989,16 +989,21 @@
 ) !=
+ 
 -1:%0A
-%09%09%09%09
+        
 log(
@@ -1063,14 +1063,25 @@
 ?%22)%0A
-%09%09%09%09%09%09%09%0A%0A
+%0A# vim: ts=4:sw=4:et
 %0A

Normalize codebase