Exemple #1
0
        /// <summary>
        /// Generates a command help message based on certain parameters
        /// </summary>
        /// <param name="prefix">The prefix to use for each command (for example "/")</param>
        /// <param name="group">The group to get commands from</param>
        /// <param name="level">The gamemaster level to determine which commands to show</param>
        /// <returns>A string that represents the help message</returns>
        private static string GenerateCommandHelpMessage(char prefix, Dictionary <string, CommandHandler> group,
                                                         GameMasterLevel level)
        {
            var help = new StringBuilder();

            help.AppendLine("Available commands:");

            foreach (var handlerInfo in group.Values.Where(handlerInfo => level >= handlerInfo.GameMasterLevel))
            {
                help.AppendLine($"{prefix}{handlerInfo.Signature} \n" +
                                $"      {handlerInfo.Help}");
            }

            return(help.ToString());
        }
Exemple #2
0
        /// <summary>
        /// Generates a command help message based on certain parameters
        /// </summary>
        /// <param name="prefix">The prefix to use for each command (for example "/")</param>
        /// <param name="group">The group to get commands from</param>
        /// <param name="level">The gamemaster level to determine which commands to show</param>
        /// <returns>A string that represents the help message</returns>
        private static string GenerateCommandHelpMessage(char prefix, Dictionary <string, CommandHandler> group,
                                                         GameMasterLevel level)
        {
            var help = new StringBuilder();

            foreach (var handlerInfo in group.Values.Where(handlerInfo => level >= handlerInfo.GameMasterLevel))
            {
                if (!handlerInfo.ConsoleCommand)
                {
                    continue;
                }
                help.AppendLine($"{prefix}{handlerInfo.Signature}" +
                                $"{(string.Concat(Enumerable.Repeat(" ", 20 - handlerInfo.Signature.Length)))}" +
                                $"{handlerInfo.Help}");
            }

            return(help.ToString());
        }
Exemple #3
0
 public async Task <string> HandleCommandAsync(string command, object author, GameMasterLevel gameMasterLevel)
 {
     if (command == default)
     {
         return(default);