IRC event-driven library (mirrored from https://github.com/aewens/ircevents)
Go to file
aewens c77420a9f8 Fixed travis-ci config 2020-03-12 13:28:46 -05:00
ircevents Initial commit 2020-03-12 13:17:08 -05:00
.gitignore Initial commit 2020-03-12 13:17:08 -05:00
.travis.yml Fixed travis-ci config 2020-03-12 13:28:46 -05:00
LICENSE Initial commit 2020-03-12 13:17:08 -05:00
README.md Initial commit 2020-03-12 13:17:08 -05:00
VERSION Initial commit 2020-03-12 13:17:08 -05:00
requirements.txt Initial commit 2020-03-12 13:17:08 -05:00
setup.py Initial commit 2020-03-12 13:17:08 -05:00

README.md

ircstates

Build Status

usage

example code

import ircstates, ircevents, socket

NICK = "nickname"
CHAN = "#chan"
HOST = "127.0.0.1"
POST = 6667

server = ircstates.Server("freenode")
sock   = socket.socket()

sock.connect((HOST, POST))

def _send(s):
    line = irctokens.tokenise(s)
    server.send(line)

_send("USER test 0 * :test")
_send("NICK test321")

while True:
    while server.pending():
        send_lines = server.sent(sock.send(server.pending()))
        for line in send_lines:
            print(f"> {line.format()}")

    recv_lines = server.recv(sock.recv(1024))
    for line in recv_lines:
        print(f"< {line.format()}")

        # user defined behaviors...
        if line.command == "001" and not "#test321" in server.channels:
            _send("JOIN #test321")