Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys, socket, string
- servers = [ "irc.pirc.pl",
- "unixstorm.pirc.pl",
- "gdansk.pirc.pl",
- "chommik.pirc.pl",
- "insomnia.pirc.pl",
- "bshellzpl.pirc.pl",
- "wembley.pirc.pl",
- "legowisko.pirc.pl",
- "mydevil.pirc.pl",
- "paris.pirc.pl",
- "irc.freenode.net", ]
- random_server = servers[0]
- port = 6667
- channel = "#testingchannel1"
- nick = "Script_Bot__"
- #irc = socket.socket()
- irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
- irc.connect((random_server, port))
- irc.send(bytes("USER %s +i +w * :%s\r\n" % (nick, nick)).decode("UTF-8"))
- irc.send(bytes("NICK %s\r\n" % nick).decode("UTF-8"))
- irc.send(bytes("JOIN %s\r\n" % channel).decode("UTF-8"))
- irc.send(bytes("PRIVMSG %s :Hello\r\n" % channel).decode("UTF-8"))
- while True:
- data = irc.recv(2048).decode("UTF-8")
- if(data.find("PING") != -1):
- irc.send(bytes("PONG " + data.split()[1] + "\r\n").decode("UTF-8"))
- irc.send(bytes("PRIVMSG %s :PING PONG\r\n" % channel).decode("UTF-8"))
- print data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement