예제 #1
0
        public async Task ViewProfileAsync(string tag)
        {
            var player = await Clash.GetPlayerAsync(tag);

            if (player is null)
            {
                await SendMessageAsync("Failed to find player.");

                return;
            }

            var builder = new EmbedBuilder
            {
                Title       = player.Name + player.Tag,
                Url         = $"https://link.clashofclans.com/en?action=OpenPlayerProfile&tag={player.Tag.Replace("#", "")}",
                Color       = Color.Blue,
                Description = $"Townhall: {player.TownHallLevel}"
            };

            builder.AddField("Heroes", string.Join("\n", player.Heroes.Where(x => x.Village == "home").Select(x => $"{x.Name}: **{x.Level}**")));
            //builder.AddField("Troops", string.Join("\n", player.Troops.Where(x => x.Village == "home").Select(x => $"{x.Name}: **{x.Level}**")));

            await SendMessageAsync(string.Empty, builder.Build());
        }