Advertisement
Aha2Y

Untitled

Mar 7th, 2012
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. #!/usr/bin/python
  2. import socket
  3.  
  4. s = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
  5. s.connect ( ( host, 6667) )
  6. s.send ( 'NICK %s\r\n' % nick)
  7. s.send ( 'USER %s %s %s :%s\r\n' % (nick, ident, host, name)) ; print("Succesfully entered %s" % host)
  8. s.send ( 'JOIN %s\r\n' % channel) ; print("Succesfully joined %s" % channel)
  9. s.send ( 'PRIVMSG NickServ :Identify %s\r\n' % nickpass) ; print("Succesfully identifed with nickserv")
  10. while True:
  11.    data = s.recv ( 4096 )
  12.    raw = data.split()
  13.    print data
  14.    nick = data.split('!')[0][1:]
  15.    if data.find ( 'PING' ) != -1:
  16.       s.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  17.    if data.find ( ':@calc' ) != -1:
  18.       channel = raw[2]
  19.       if len(raw) != 5:      
  20.          s.send('notice %s :Prefix: @calc <numbers> \r\n' % nick)
  21.       else:
  22.          s.send('notice %s :%s\r\n' % eval(raw[4]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement