示例#1
0
        public static async Task DisplayCommandHelpAsync(CommandInfo command, ICommandContext context)
        {
            string title = command.Name;

            if (command.Aliases.Count > 1)
            {
                title += $" ({string.Join('|', command.Aliases)})";
            }

            string prefix = ExtractPrefixFromContext(context);

            StringBuilder description = new StringBuilder()
                                        .AppendLine(command.Summary.WithAlternative(_noDescription))
                                        .AppendLine()
                                        .AppendLine("**Module**: " + command.Module.Name.Sanitize())
                                        .AppendLine("**Usage**: " + (string.IsNullOrEmpty(command.Remarks) ? _noUsage : prefix + command.Remarks));

            EmbedBuilder builder = new EmbedBuilder()
                                   .WithTitle(title)
                                   .WithDescription(description.ToString())
                                   .WithColor(command.GetColor())
                                   .WithFields(command.Parameters.Select(InfoToEmbedField));

            await builder.Build().SendToChannel(context.Channel);
        }