-
-
Save jrabbit/1517124 to your computer and use it in GitHub Desktop.
Python irc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nibbler.py | |
import sys | |
import socket | |
import string | |
class connection (object): | |
__init__(self): | |
self.network = "irc.freenode.net" | |
self.port = 6667 | |
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
self.irc.connect((self.network, self.port)) | |
def send(self, msg): | |
self.irc.send(b"%s\r\n" % msg) | |
my_connection = connection() | |
my_connection.send("NICK") | |
my_connection.send("USER nibbl3r nibbl3r nibbl3r") | |
my_connection.send("JOIN #tofaffy") | |
my_connection.send("PRIVMSG #tofaffy :Hello.") | |
while True: | |
data = my_connection.irc.recv(4096) | |
if data.find(b"PING"): | |
send("PONG " + data.split()[1]) | |
print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment