Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import socket
- host1 = 'irc.rizon.net'
- host2 = 'irc.hardchats.org'
- nick = 'vTox' ; ident = 'vTox' ; name = 'IRC Robot'
- channel = '#vTox'
- s = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
- x = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
- s.connect ( ( host1, 6667) )
- x.connect ( ( host2, 6667) )
- s.send ( 'NICK %s\r\n' % nick)
- x.send ( 'NICK %s\r\n' % nick)
- s.send ( 'USER %s %s %s :%s\r\n' % (nick, ident, host1, name)) ; print("Succesfully entered %s" % host1)
- x.send ( 'USER %s %s %s :%s\r\n' % (nick, ident, host2, name)) ; print("Succesfully entered %s" % host2)
- s.send ( 'JOIN %s\r\n' % channel) ; print("Succesfully joined %s" % channel)
- x.send ( 'JOIN %s\r\n' % channel) ; print("Succesfully joined %s" % channel)
- s.send ( 'PRIVMSG NickServ :Identify %s\r\n' % nickpass) ; print("Succesfully identifed with nickserv")
- while True:
- data = s.recv ( 4096 )
- raw = data.split()
- print data
- nick = data.split('!')[0][1:]
- if data.find ( 'PING' ) != -1:
- s.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
- if data.find ( ':$help' ) != -1:
- channel = raw[2]
- if len(raw) != 5:
- s.send('notice %s :[Public] $calc\r\n' % nick)
- if data.find ( ':$calc' ) != -1:
- channel = raw[2]
- if len(raw) != 5:
- s.send('notice %s :Prefix: $calc <numbers> \r\n' % nick)
- else:
- s.send('privmsg %s :%s\r\n' % (raw[2], eval(raw[4])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement