Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import socket
- s = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
- s.connect ( ( host, 6667) )
- s.send ( 'NICK %s\r\n' % nick)
- s.send ( 'USER %s %s %s :%s\r\n' % (nick, ident, host, name)) ; print("Succesfully entered %s" % host)
- s.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 ( ':@calc' ) != -1:
- channel = raw[2]
- if len(raw) != 5:
- s.send('notice %s :Prefix: @calc <numbers> \r\n' % nick)
- else:
- s.send('notice %s :%s\r\n' % eval(raw[4]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement