Go to file
jesopo 8bc034241f 0.2.0 release 2020-03-11 13:52:33 +00:00
irctokens fix _escape_tag typehint issue 2020-03-11 13:44:44 +00:00
test add tests for Line formatting 2020-03-11 13:43:13 +00:00
.gitignore Initial commit 2020-03-11 11:26:13 +00:00
.travis.yml change mypy in .travis.py to point to new package 2020-03-11 12:22:39 +00:00
LICENSE Initial commit 2020-03-11 11:26:13 +00:00
README.md add formatting examples to README.md 2020-03-11 13:51:08 +00:00
VERSION 0.2.0 release 2020-03-11 13:52:33 +00:00
setup.py add pypi setup.py file 2020-03-11 12:35:52 +00:00

README.md

irctokens

Build Status

rationale

there's far too many IRC client implementations out in the world that do not tokenise data correctly and thus fall victim to things like colons either being where you don't expect them or not being where you expect them.

usage

tokenisation

import irctokens
line = irctokens.tokenise(
    "@id=123 :jess!~jess@hostname PRIVMSG #chat :hello there!")

if line.command == "PRIVMSG":
    print(f"received message from {line.source}"
          f" to {line.params[0]}: {line.params[1]}")

formatting

import sockets
import irctokens

sock = socket.socket()
sock.connect(("127.0.0.1", 6667))

line = irctokens.format("USER", ["user", "0", "*", "real name"])
to_send = "%s\r\n" % line
sock.send(to_send.encode("utf8"))