Skip to content

Instantly share code, notes, and snippets.

@azenla
Last active August 29, 2015 14:06
Show Gist options
  • Save azenla/5e621cc8296960524b42 to your computer and use it in GitHub Desktop.
Save azenla/5e621cc8296960524b42 to your computer and use it in GitHub Desktop.
library manager;
import "dart:io";
import "package:irc/irc.dart" show Color;
import 'package:polymorphic_bot/api.dart';
BotConnector bot;
EventManager eventManager;
void main(List<String> args, port) {
bot = new BotConnector(port);
eventManager = bot.createEventManager();
eventManager.command("plugin", (event) {
if (event.args.length == 0) {
event.reply("Subcommands: install, update");
} else if (event.args[0].toLowerCase() == "install" && event.args.length >= 2) {
String queuedPackage = event.args[1];
event.reply("Queuing ${queuedPackage} to install");
Process.run("git", ["clone", "git://github.com/PolymorphicBot/${queuedPackage}.git", "plugins/${queuedPackage}"]).then((p) {
event.reply("Exit Code: ${p.exitCode}");
});
} else {}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment