-
Notifications
You must be signed in to change notification settings - Fork 15
Getting Started
Seth Ladd edited this page Sep 12, 2015
·
13 revisions
Add the following to your pubspec.yaml
dependencies:
irc: ">=2.1.6 <2.2.0"
After that, run pub get
From the soon to be released v3.0.0, irc.dart now supports user objects, which are global across the client. This means you don't have to deal with nicknames anymore.
import "package:irc/client.dart";
// This stores our configuration for this client
var config = new Configuration(host: "irc.esper.net", port: 6667, nickname: "DartBot", username: "DartBot");
// "Primary" IRC class
var client = new Client(config);
main() async {
// Register an onReady event handler
await for (var event in client.onReady) {
// Join a channel
event.join("#directcode");
}
// Register an onMessage event handler
await for (var event in client.onMessage)
// Log any message events to the console
print("<${event.target.name}><${event.from.name}> ${event.message}");
}
// Connect to the server
client.connect();
}