/// <summary> /// The on command. /// </summary> /// <param name="messageType"> /// The message type. /// </param> /// <param name="command"> /// The command. /// </param> /// <param name="parameters"> /// The parameters. /// </param> /// <param name="sender"> /// The sender. /// </param> internal void OnCommand(EventDispatcher.MessageType messageType, string command, string[] parameters, IrcIdentity sender) { CommandDispatcher.Dispatch(command, parameters, sender, this.ServerUser, this); }
/// <summary> /// The on message. /// </summary> /// <param name="messageType"> /// The message type. /// </param> /// <param name="message"> /// The message. /// </param> /// <param name="sender"> /// The sender. /// </param> internal void OnMessage(EventDispatcher.MessageType messageType, string message, IrcIdentity sender) { if (this.ServerUser.IsMe(sender)) { return; } if (messageType == EventDispatcher.MessageType.Message) { Commands.Interprete(message, sender, this.ServerUser, this); } else { Debug.WriteLine( string.Format( "Message \"{0}\" (from {1})", message, (sender != null) ? sender.Nickname.ToString() : "Anonymous"), this.ToString()); } }
/// <summary> /// The on message. /// </summary> /// <param name="messageType"> /// The message type. /// </param> /// <param name="chatMessageEventArgs"> /// The chat message event args. /// </param> internal void OnMessage(EventDispatcher.MessageType messageType, ChatMessageEventArgs chatMessageEventArgs) { string message = chatMessageEventArgs.Message; var channel = this.GetChannel(chatMessageEventArgs.Recipient, true); var command = this.GetCommand(chatMessageEventArgs.Message); if (null == channel) { // This message/command was a personal message to the bot. Debug.WriteLine( string.Format( "Message \"{0}\" (from {1} to {2})", message, (chatMessageEventArgs.Sender != null) ? chatMessageEventArgs.Sender.Nickname.ToString() : "Anonymous", chatMessageEventArgs.Recipient), this.ToString()); return; } // A channel message/command if (null == command) { // A message channel.OnMessage(messageType, message, chatMessageEventArgs.Sender); } else { // A command channel.OnCommand(messageType, command, GetParameters(message), chatMessageEventArgs.Sender); } }