irc 1.2.2-dev.2
irc: ^1.2.2-dev.2 copied to clipboard
A feature-full Dart IRC library
Dart IRC
#
The Beautiful IRC Library for Dart that WORKS!
Report any issues here!
Links #
Design #
irc.dart is designed to work out of the box in a very configurable way.
- Optional Synchronous System
- Builtin Bot System
- Ability to create your own bots
- Easy to Understand API
- Use of a lot of Language Features
- Optionally use only what you need
Bots #
Command Bot #
The command bot is just a normal bot implementation of commands.
import 'package:irc/irc.dart';
void main() {
BotConfig config = new BotConfig(
host: "irc.freenode.net",
port: 6667,
nickname: "DartBot",
username: "DartBot"
);
CommandBot bot = new CommandBot(config, prefix: ".");
bot.register((ReadyEvent event) {
event.join("#irc.dart");
});
bot.command("help").listen((CommandEvent event) {
event.reply("> ${Color.BLUE}Commands${Color.RESET}: ${bot.commands.keys.join(', ')}");
});
bot.connect();
}
Dumb Bot #
This bot just prints messages to the console.
import 'package:irc/irc.dart';
void main() {
BotConfig config = new BotConfig(
host: "irc.freenode.net",
port: 6667,
nickname: "DartBot",
username: "DartBot"
);
CommandBot bot = new DumbBot(config);
bot.register((ReadyEvent event) {
event.join("#irc.dart");
});
bot.connect();
}
Library #
There is also a plain library to write your own IRC Bots!
import 'package:irc/irc.dart';
void main() {
BotConfig config = new BotConfig(
host: "irc.esper.net",
port: 6667,
nickname: "DartBot",
username: "DartBot"
);
Client client = new Client(config);
client.register((ReadyEvent event) {
event.join("#DirectCode");
});
client.connect();
}