コード例 #1
0
        public async Task Help(params string[] args)
        {
            await p.DoAction(Context.User, Program.Module.Information);

            EmbedBuilder embed = new EmbedBuilder()
            {
                Title = Sentences.Help(Context.Guild),
                Color = Color.Purple
            };
            string animeMangaModule       = Sentences.AnimeMangaModuleName(Context.Guild);
            string arknightsModule        = Sentences.ArknightsModuleName(Context.Guild);
            string booruModule            = Sentences.BooruModuleName(Context.Guild);
            string codeModule             = Sentences.CodeModuleName(Context.Guild);
            string communicationModule    = Sentences.CommunicationModuleName(Context.Guild);
            string communityModule        = Sentences.CommunityModuleName(Context.Guild);
            string doujinshiModule        = Sentences.DoujinshiModuleName(Context.Guild);
            string gameModule             = Sentences.GameModuleName(Context.Guild);
            string informationModule      = Sentences.InformationModuleName(Context.Guild);
            string kantaiCollectionModule = Sentences.KantaiCollectionModuleName(Context.Guild);
            string linguisticModule       = Sentences.LinguisticModuleName(Context.Guild);
            string radioModule            = Sentences.RadioModuleName(Context.Guild);
            string settingsModule         = Sentences.SettingsModuleName(Context.Guild);
            string visualNovelModule      = Sentences.VisualNovelModuleName(Context.Guild);
            string xkcdModule             = Sentences.XkcdModuleName(Context.Guild);
            string youtubeModule          = Sentences.YoutubeModuleName(Context.Guild);
            string page     = string.Join(" ", args).ToLower();
            var    textChan = Context.Channel as ITextChannel;
            var    isNsfw   = textChan == null ? false : textChan.IsNsfw;

            if (page != "" && (page == "1" || animeMangaModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + animeMangaModule + ")";
                embed.Description = Sentences.AnimeMangaHelp(Context.Guild, Settings.CanModify(Context.User, Context.Guild));
            }
            else if (page != "" && (page == "2" || arknightsModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + arknightsModule + ")";
                embed.Description = Sentences.ArknightsHelp(Context.Guild);
            }
            else if (page != "" && (page == "3" || booruModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + booruModule + ")";
                embed.Description = Sentences.BooruHelp(Context.Guild, isNsfw);
            }
            else if (page != "" && (page == "4" || codeModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + codeModule + ")";
                embed.Description = Sentences.CodeHelp(Context.Guild);
            }
            else if (page != "" && (page == "5" || communicationModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + communicationModule + ")";
                embed.Description = Sentences.CommunicationHelp(Context.Guild);
            }
            else if (page != "" && (page == "6" || communityModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + communityModule + ")";
                embed.Description = Sentences.CommunityHelp(Context.Guild, Context.User.Id == Base.Sentences.ownerId);
            }
            else if (page != "" && (page == "7" || doujinshiModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + doujinshiModule + ")";
                embed.Description = Sentences.DoujinshiHelp(Context.Guild, isNsfw);
            }
            else if (page != "" && (page == "8" || gameModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + gameModule + ")";
                embed.Description = Sentences.GameHelp(Context.Guild, isNsfw);
            }
            else if (page != "" && (page == "9" || informationModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + informationModule + ")";
                embed.Description = Sentences.InformationHelp(Context.Guild);
            }
            else if (page != "" && (page == "10" || kantaiCollectionModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + kantaiCollectionModule + ")";
                embed.Description = Sentences.KantaiCollectionHelp(Context.Guild);
            }
            else if (page != "" && (page == "11" || linguisticModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + linguisticModule + ")";
                embed.Description = Sentences.LinguisticHelp(Context.Guild, isNsfw);
            }
            else if (page != "" && (page == "12" || radioModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + radioModule + ")";
                embed.Description = Sentences.RadioHelp(Context.Guild);
            }
            else if (page != "" && (page == "13" || settingsModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + settingsModule + ")";
                embed.Description = Sentences.SettingsHelp(Context.Guild, Settings.CanModify(Context.User, Context.Guild), Context.User.Id == Base.Sentences.ownerId);
            }
            else if (page != "" && (page == "14" || visualNovelModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + visualNovelModule + ")";
                embed.Description = Sentences.VisualNovelHelp(Context.Guild);
            }
            else if (page != "" && (page == "15" || xkcdModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + xkcdModule + ")";
                embed.Description = Sentences.XkcdHelp(Context.Guild);
            }
            else if (page != "" && (page == "16" || youtubeModule.ToLower().Contains(page)))
            {
                embed.Title      += " (" + youtubeModule + ")";
                embed.Description = Sentences.YouTubeHelp(Context.Guild);
            }
            else
            {
                var guildId = Context.Guild?.Id ?? 0;
                embed.Description = Sentences.HelpHelp(Context.Guild) + Environment.NewLine +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.AnimeManga) ? "**1**: " + animeMangaModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Arknights) ? "**2**: " + arknightsModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Booru) ? "**3**: " + booruModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Code) ? "**4**: " + codeModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Communication) ? "**5**: " + communicationModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Community) ? "**6**: " + communityModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Doujinshi) ? "**7**: " + doujinshiModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Game) ? "**8**: " + gameModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Information) ? "**9**: " + informationModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Kancolle) ? "**10**: " + kantaiCollectionModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Linguistic) ? "**11**: " + linguisticModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Radio) ? "**12**: " + radioModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Settings) ? "**13**: " + settingsModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Vn) ? "**14**: " + visualNovelModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Xkcd) ? "**15**: " + xkcdModule + Environment.NewLine : "") +
                                    (Program.p.db.IsAvailable(guildId, Program.Module.Youtube) ? "**16**: " + youtubeModule + Environment.NewLine: "");
            }
            await ReplyAsync("", false, embed.Build());
        }