Advertisement
Aha2Y

Untitled

Mar 7th, 2012
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. import socket
  3.  
  4. host1 = 'irc.rizon.net'
  5. host2 = 'irc.hardchats.org'
  6.  
  7. nick = 'vTox' ; ident = 'vTox' ; name = 'IRC Robot'
  8. channel = '#vTox'
  9.  
  10. s = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
  11. x = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
  12. s.connect ( ( host1, 6667) )
  13. x.connect ( ( host2, 6667) )
  14. s.send ( 'NICK %s\r\n' % nick)
  15. x.send ( 'NICK %s\r\n' % nick)
  16. s.send ( 'USER %s %s %s :%s\r\n' % (nick, ident, host1, name)) ; print("Succesfully entered %s" % host1)
  17. x.send ( 'USER %s %s %s :%s\r\n' % (nick, ident, host2, name)) ; print("Succesfully entered %s" % host2)
  18. s.send ( 'JOIN %s\r\n' % channel) ; print("Succesfully joined %s" % channel)
  19. x.send ( 'JOIN %s\r\n' % channel) ; print("Succesfully joined %s" % channel)
  20. s.send ( 'PRIVMSG NickServ :Identify %s\r\n' % nickpass) ; print("Succesfully identifed with nickserv")
  21. while True:
  22.    data = s.recv ( 4096 )
  23.    raw = data.split()
  24.    print data
  25.    nick = data.split('!')[0][1:]
  26.    if data.find ( 'PING' ) != -1:
  27.       s.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  28.    if data.find ( ':$help' ) != -1:
  29.       channel = raw[2]
  30.       if len(raw) != 5:      
  31.          s.send('notice %s :[Public] $calc\r\n' % nick)
  32.    if data.find ( ':$calc' ) != -1:
  33.       channel = raw[2]
  34.       if len(raw) != 5:      
  35.          s.send('notice %s :Prefix: $calc <numbers> \r\n' % nick)
  36.       else:
  37.          s.send('privmsg %s :%s\r\n' % (raw[2], eval(raw[4])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement