Ejemplo n.º 1
0
        private static void CommandList(CommandParams parameters)
        {
            string        commands = "";
            List <string> list     = new List <string>(CommandPool.CommandsList.Keys);

            list.Sort();
            foreach (string command in list)
            {
                commands += command;
                commands += ", ";
            }
            if (commands.EndsWith(", ", System.StringComparison.InvariantCulture))
            {
                commands = commands.Substring(0, commands.Length - 2);
            }

            if (parameters.SourceChannel != null)
            {
                int max_possible_length = IRC.GetMaxMessageLength(parameters.SourceChannel);
                // "I know: "
                max_possible_length -= 8;
                if (commands.Length > max_possible_length)
                {
                    commands = commands.Substring(0, max_possible_length - 3) + "...";
                }
                IRC.DeliverMessage("I know: " + commands, parameters.SourceChannel);
            }
            else if (parameters.SourceUser != null)
            {
                IRC.DeliverMessage("I know: " + commands, parameters.SourceUser);
            }
        }