示例#1
0
        /// <summary>
        /// Takes in the embed builder and adds the formatted help page.
        /// </summary>
        /// <param name="eb">The embed builder</param>
        private void AddHelpPage(EmbedBuilder eb)
        {
            if (BotUtils.GetFileExtension(Path) == "json")
            {
                // Interpret JSON
                HelpPageNode page = HelpManager.GetNode(Path);

                eb.AddField("Command Name", $"{page.Name}");

                if (page.Alias.Length > 0)
                {
                    string alias = "!" + page.Alias[0];

                    for (int i = 1; i < page.Alias.Length; i++)
                    {
                        alias += $", !{page.Alias[i]}";
                    }

                    eb.AddField("Aliases", alias);
                }

                eb.AddField("Usage", page.Usage);
                eb.AddField("Description", page.Description);

                if (!string.IsNullOrWhiteSpace(page.GifURL))
                {
                    eb.AddField("Example:", BotUtils.ZeroSpace);
                    eb.WithImageUrl(page.GifURL);
                }
            }
            else
            {
                // Assume it's text. All other files are ignored anyways
                string text = FileManager.ReadFullFile(Path);
                eb.AddField(BotUtils.ZeroSpace, text);
            }
        }