public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int channel    = 0;
            int startIndex = 0;

            if (args.Length < 1)
            {
                return(ShowUsage()); // " say (optional channel) whatever";
            }
            else if (args.Length > 1 && (args[0].StartsWith("/") || args[0].StartsWith("#")))
            {
                if (Int32.TryParse(args[0].Substring(1), out channel))
                {
                    startIndex = 1;
                }
            }

            StringBuilder message = new StringBuilder();

            for (int i = startIndex; i < args.Length; i++)
            {
                message.Append(args[i]);
                if (i != args.Length - 1)
                {
                    message.Append(" ");
                }
            }
            string text = message.ToString();

            if (text.StartsWith("<") && text.EndsWith(">"))
            {
                TheBotClient.XmlTalk(text, WriteLine);
                return(Success("xmlsaid: " + text));
            }
            if (channel == 0)
            {
                TheBotClient.Talk(text);
            }
            else
            {
                TheBotClient.Talk(text, channel, ChatType.Normal);
            }
            return(args.Complete(Name, "said: " + text, true));
        }
Example #2
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int channel = 0;
            int startIndex = 0;

            if (args.Length < 1)
            {
                return ShowUsage(); // " say (optional channel) whatever";
            }
            else if (args.Length > 1 && (args[0].StartsWith("/") || args[0].StartsWith("#")))
            {
                if (Int32.TryParse(args[0].Substring(1), out channel))
                    startIndex = 1;
            }

            StringBuilder message = new StringBuilder();

            for (int i = startIndex; i < args.Length; i++)
            {
                message.Append(args[i]);
                if (i != args.Length - 1) message.Append(" ");
            }
            string text = message.ToString();
            if (text.StartsWith("<") && text.EndsWith(">"))
            {
                TheBotClient.XmlTalk(text, WriteLine);
                return Success("xmlsaid: " + text);
            }
            if (channel == 0)
            {
                TheBotClient.Talk(text);
            }
            else
            {
                TheBotClient.Talk(text, channel, ChatType.Normal);
            }
            return args.Complete(Name, "said: " + text, true);
        }