public List <Page> CreateOpSkinPages(OpSkin op)
        {
            List <Page> pages = new List <Page>();

            if (op.Skins != null && op.Skins.Any())
            {
                foreach (Skin s in op.Skins)
                {
                    string img   = s.PortraitId.Replace("#", "%23");
                    string title = $"[{op.Rarity}★] {op.Name}";
                    string f1    = $"{Formatter.Bold("Model:")} {op.Name}\n" +
                                   $"{Formatter.Bold("Artist:")} {s.Artist}";
                    string f2   = $"{Formatter.Bold("Series:")} {s.SkinGroupName}";
                    string desc = "\u200b";
                    if (!string.IsNullOrWhiteSpace(s.DisplayName))
                    {
                        title += $" - {s.DisplayName}";
                    }
                    if (!string.IsNullOrWhiteSpace(s.ObtainApproach))
                    {
                        f2 += $"\n{Formatter.Bold("Obtain Approach:")} {s.ObtainApproach}";
                    }
                    if (!string.IsNullOrWhiteSpace(s.Content))
                    {
                        desc = s.Content;
                    }
                    DiscordEmbedBuilder embed = new DiscordEmbedBuilder()
                                                .WithTitle(title)
                                                .WithThumbnail($"{s3.Url}avatars/{img}.png", 60, 60)
                                                .WithDescription(desc)
                                                .AddField("Detail", f1, true)
                                                .AddField("\u200b", f2, true)
                                                .WithImageUrl($"{s3.Url}characters/{img}.png");
                    if (!string.IsNullOrWhiteSpace(s.Usage))
                    {
                        embed.AddField("Usage", s.Usage);
                    }
                    if (!string.IsNullOrWhiteSpace(s.Desc))
                    {
                        embed.AddField("Quote", s.Desc);
                    }
                    if (!string.IsNullOrWhiteSpace(s.Dialog))
                    {
                        embed.AddField("Information", s.Dialog);
                    }
                    pages.Add(new Page {
                        Embed = embed.Build()
                    });
                }
            }
            return(pages);
        }
Exemplo n.º 2
0
        public async Task GetOperatorSkins(CommandContext ctx,
                                           [Description("Operator's name")] string name)
        {
            try
            {
                OpSkin op = await operatorService.GetOperatorSkin(name);

                if (op is null)
                {
                    await ctx.RespondAsync("Operator not found.");

                    return;
                }
                var         itr   = ctx.Client.GetInteractivity();
                List <Page> pages = embedService.CreateOpSkinPages(op);
                await itr.SendPaginatedMessageAsync(ctx.Channel, ctx.User, pages, timeoutoverride : TimeSpan.FromMinutes(5));
            }
            catch (Exception e)
            {
                await ctx.RespondAsync($"An error occurred:{e.Message}");
            }
        }