public void ListenForCommandTest() { var called = false; var commands = new List <IBotCommand> (); var listenerwords = new List <String> (); listenerwords.Add("PRIVMSG"); commands.Add(new Pipecleaner(listenerwords, new List <String> (), new List <string> (), false, SecureLevelEnum.Bot)); var controller = new BotController(commands, String.Empty); controller.MessageSent += (s, e) => called = true; controller.ReceiveMessageHandler(this, IRCMessageFactory.BuildSendChannelMessage("#foo", "foobar")); Assert.AreEqual(true, called, "ERROR: Bot did not pick up on command"); }
public void IRCMessageFactoryTests() { IRCMessage message = IRCMessageFactory.BuildActionMessage("#foo", "bar"); Assert.AreEqual("ACTION #foo :bar", message.ToIRCString()); message = IRCMessageFactory.BuildJoinChannelMessage("#foo"); Assert.AreEqual("JOIN #foo", message.ToIRCString()); message = IRCMessageFactory.BuildSetNickMessage("foo"); Assert.AreEqual("NICK :foo", message.ToIRCString()); message = IRCMessageFactory.BuildSendPassMessage("foo"); Assert.AreEqual("PASS foo", message.ToIRCString()); message = IRCMessageFactory.BuildPingMessage("foo.bar"); Assert.AreEqual("PING :foo.bar", message.ToIRCString()); message = IRCMessageFactory.BuildPongMessage("foo.bar"); Assert.AreEqual("PONG :foo.bar", message.ToIRCString()); message = IRCMessageFactory.BuildSendChannelMessage("#foo", "bar"); Assert.AreEqual("PRIVMSG #foo :bar", message.ToIRCString()); message = IRCMessageFactory.BuildQuitMessage(); Assert.AreEqual("QUIT", message.ToIRCString()); message = IRCMessageFactory.BuildPartMessage("#foo"); Assert.AreEqual("PART #foo", message.ToIRCString()); message = IRCMessageFactory.BuildUserMessage("foo", "foobar"); Assert.AreEqual("USER foo 0 * :foobar", message.ToIRCString()); }
public override void Execute(object sender, IRCMessage message) { var parameters = String.Format("identify {0}", _password); OnScriptMessage(IRCMessageFactory.BuildSendChannelMessage(_nickServName, parameters)); }
public override void Execute(object sender, IRCMessage message) { OnScriptMessage(IRCMessageFactory.BuildSendChannelMessage("bot", "Pipe Cleaner Invoked")); }