Exemple #1
0
        public void RecievePublicMessage(User from, string to, string message)
        {
            string[] msg = message.Split(' ');

            // Parse as a command
            if (msg[0].StartsWith("-"))
            {
                // -ExternalCommand Params
                IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Magenta);

                string   command   = msg[0].Substring(1);
                object[] arguments = msg.Length > 1 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { };

                parent.IssueCommand(this, from, command, arguments);
            }
            else if (msg[0].StartsWith("+"))
            {
                IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Yellow);
                string   command   = msg[0].Substring(1);
                object[] arguments = msg.Length > 0 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { };
                CoreCommands.Execute(command, this.parent, this, from.Nick, arguments);
            }
            else // Just display the message in a specified colour
            {
                IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Green);
            }
        }
Exemple #2
0
 private void Irc_OnPrivateMessage(User from, string to, string message)
 {
     string[] msg = message.Split(' ');
     if (msg[0].StartsWith("."))
     {
         // This is a private command, We won't display messages here
         string   command   = msg[0].Substring(1);
         object[] arguments = msg.Length > 1 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { };
         CoreCommands.Execute(command, this, null, from.Nick, arguments);
     }
     else
     {
         Format("<{0}> {1}", ConsoleColor.DarkRed, from.Nick, message);
     }
 }