示例#1
0
        public override BaseHelpFormatter WithCommand(DSharpPlus.CommandsNext.Command command)
        {
            MessageBuilder.Append("Command: ")
            .AppendLine(Formatter.Bold(command.Name))
            .AppendLine();


            MessageBuilder.Append("Description: ")
            .AppendLine(command.Description)
            .AppendLine();

            if (command is CommandGroup)
            {
                MessageBuilder.AppendLine("This group has a standalone command.").AppendLine();
            }
            if (command.Aliases != null && command.Aliases.Any())
            {
                Console.WriteLine("Aaa" + command.Aliases.Count);
                MessageBuilder.Append("Aliases: ")
                .AppendLine(string.Join(", ", command.Aliases))
                .AppendLine();
            }
            foreach (var overload in command.Overloads)
            {
                if (overload.Arguments.Count == 0)
                {
                    continue;
                }

                MessageBuilder.Append($"[Overload {overload.Priority}] Arguments: ")
                .AppendLine(string.Join(", ", overload.Arguments.Select(xarg => $"{xarg.Name} ({xarg.Type.Name})")))
                .AppendLine();
            }
            return(this);
        }
示例#2
0
 public static Category GetCategory(this Cmd command) =>
 command?.CustomAttributes.OfType <CategoryAttribute>().FirstOrDefault()?.Category ?? Category.Unsorted;