Esempio n. 1
0
        private HelpSection GetSection(CommandInfo command)
        {
            string title    = GetSectionTitle(command);
            string summary  = GetSummary(command);
            string examples = GetExamples(command);

            var content = new StringBuilder();

            _ = content.Append(_lang.GetPhrase(PhraseKey.HELP_SUMMARY_TITLE.ToString()))
                .AppendLine(summary)
                .Append(_lang.GetPhrase(PhraseKey.HELP_EXAMPLE_TITLE.ToString()))
                .AppendLine(examples);

            var permissions = command.FindPrecondition <RequireUserPermissionAttribute>();

            if (permissions != null)
            {
                if (permissions.GuildPermission
                    .GetValueOrDefault(0)
                    .HasFlag(GuildPermission.Administrator))
                {
                    _ = content.Append(_lang.GetPhrase(PhraseKey.HELP_REQUIRES_ADMIN.ToString()));
                }
            }

            return(new HelpSection(title, content.ToString()));
        }