コード例 #1
0
ファイル: WaifuUtil.cs プロジェクト: ta1H3n/Namiko
        public static CustomPaginatedMessage PaginatedShopMessage(IEnumerable<ShopWaifu> waifus, int pageSize, string prefix, ulong guildId = 0, ShopType type = ShopType.Waifu)
        {
            CustomPaginatedMessage paginatedMessage = new CustomPaginatedMessage();
            var fieldList = new List<FieldPages>();
            var splitWaifus = CustomPaginatedMessage.Split(waifus, pageSize);
            int pages = splitWaifus.Count();

            var fieldInfo = new FieldPages();
            var pagelist = new List<string>();
            fieldInfo.Title = ":books: Commands";
            for (int i = 0; i < pages; i++)
            {
                pagelist.Add($"`{prefix}BuyWaifu [name]` | `{prefix}Waifu [search]` | `{prefix}Ws` | `{prefix}Gs` | `{prefix}Ms`");
            }
            fieldInfo.Inline = true;
            fieldInfo.Pages = pagelist;
            fieldList.Add(fieldInfo);

            var fieldWaifus = new FieldPages();
            var pagelist2 = new List<string>();
            fieldWaifus.Title = "<:MiaHug:536580304018735135> Waifus";
            foreach (var w in splitWaifus)
            {
                pagelist2.Add(WaifuUtil.WaifuShopWaifuList(w));
            }
            fieldWaifus.Pages = pagelist2;
            fieldList.Add(fieldWaifus);

            paginatedMessage.Fields = fieldList;
            paginatedMessage.Footer = $"Resets in {11 - DateTime.Now.Hour % 12} Hours {60 - DateTime.Now.Minute} Minutes | ";
            paginatedMessage.Color = BasicUtil.RandomColor();
            paginatedMessage.PageCount = pages;
            if (guildId != 0)
                paginatedMessage.Pages = new List<string> { $"Open in [browser](https://namiko.moe/WaifuShop/{guildId})" };
            paginatedMessage.Author = new EmbedAuthorBuilder()
            {
                Name = type switch
                {
                    ShopType.Waifu => "Waifu Shop",
                    ShopType.Gacha => "Gacha Shop",
                    ShopType.Mod => "Mod Shop",
                    _ => "Waifu Shop"
                },