public async Task YGOSupport(params string[] search) { string cardName = string.Join(" ", search); string[] request = await YGOAPI.GetCardSupportData(cardName); if (request != null) { var builder = new EmbedBuilder() { Color = new Color(114, 137, 218), }; builder.WithAuthor(x => { x.Name = cardName + " Support"; }); StringBuilder des = new StringBuilder(); foreach (string support in request) { des.AppendLine(support); } builder.Description = des.ToString(); await Context.Channel.SendMessageAsync("", false, builder.Build()); } else { await Context.Channel.SendMessageAsync("Card does not exist"); } }
public async Task YGOText(params string[] search) { string cardName = string.Join(" ", search); CardData request = await YGOAPI.GetCardData(cardName); if (request.status == "success") { Card data = request.data; var builder = new EmbedBuilder() { Color = new Color(114, 137, 218), }; var urlName = string.Join("_", search); builder.WithAuthor(x => { x.Name = data.name; x.Url = $"https://yugipedia.com/wiki/{urlName}"; }); StringBuilder des = new StringBuilder(); if (data.card_type.Equals("monster")) { des.AppendLine($"Level: {data.level}, " + $"Category: {capitalise(data.card_type)}, " + $"Type: {data.type}, " + $"Attribute: {capitalise(data.family)}"); des.AppendLine(); des.AppendLine(data.text); des.AppendLine(); des.AppendLine($"ATK: {data.atk}, " + $"DEF: {data.def}"); } else if (data.card_type.Equals("spell")) { des.AppendLine($"Category: {capitalise(data.card_type)}, " + $"Property: {data.property}"); des.AppendLine(); des.AppendLine(data.text); } else if (data.card_type.Equals("trap")) { des.AppendLine($"Category: {capitalise(data.card_type)}, " + $"Property: {data.property}"); des.AppendLine(); des.AppendLine(data.text); } builder.Description = des.ToString(); await Context.Channel.SendMessageAsync("", false, builder.Build()); } else { await Context.Channel.SendMessageAsync("Card does not exist"); } }