#!/usr/bin/env python # Illustrates how to test irkerd. # # First argument must be a channel URL. If it does not begin with "irc", # the base URL for freenode is prepended. # # Second argument must be a payload string. # import json import socket import sys s = socket.create_connection(("localhost", 6659)) target = sys.argv[1] if not "irc:" in target: target = "irc://chat.freenode.net/{0}".format(target) data = {"to": target, "privmsg" : " ".join(sys.argv[2:])} print(json.dumps(data)) s.sendall(json.dumps(data))