-
Notifications
You must be signed in to change notification settings - Fork 7
Home
Profan edited this page Jun 10, 2014
·
10 revisions
- CTCP
- DCC
import std.stdio;
import irc.client;
import irc.eventloop;
void main()
{
auto client = new IrcClient();
client.nickName = "MyBot";
client.userName = "foo";
client.realName = "bar";
client.onConnect ~= () {
client.join("#example");
};
client.onMessage ~= (IrcUser user, in char[] target, in char[] message) {
auto replyTarget = target == client.nickName? user.nickName : target;
client.sendf(replyTarget, "%s: %s", user.nickName, message);
};
client.onCtcpQuery ~= (IrcUser user, in char[] source, in char[] tag, in char[] data) {
if(tag == "VERSION")
client.ctcpReply(user.nickName, tag, "Dirk echo bot");
};
client.connect(new InternetAddress("irc.example.org", 6667));
auto set = new IrcEventLoop();
set.add(client);
set.run();
}