Created
July 3, 2012 01:49
-
-
Save FeepingCreature/3037016 to your computer and use it in GitHub Desktop.
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
string host; | |
string nick = "neatbot"; | |
string channel; | |
using new Options { | |
addLong("host", "h", \(string h) { host = h; }, =>required); | |
addLong("nick", "n", \(string n) { nick = n; }); | |
addLong("channel", "c", \(string c) { channel = c; }, =>required); | |
args = process args; | |
} | |
auto sock = connect (host, 6667); | |
auto rng = getPRNG 23; | |
void sendLine(string s) { | |
writeln "> $s"; | |
sock.sendAll byte[]:s; | |
sock.sendAll byte[]:"\r\n"; | |
} | |
sendLine "NICK $nick"; | |
sendLine "USER $nick $nick $nick $nick $nick"; | |
auto recv = castIter!string readDg &sock.recv #.splitAt "\r\n"; | |
for auto line <- recv { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment