Exemplo n.º 1
0
        private async Task RecommendAsync(string[] tracks = null, string[] artists = null, string[] genres = null)
        {
            var args = new GetRecommendationsParams
            {
                Limit       = 10,
                SeedArtists = artists?.ToList(),
                SeedTracks  = tracks?.ToList(),
                SeedGenres  = genres?.ToList()
            };

            var response = await _api.GetRecommendationsAsync(_config["spotify_token"], args);

            var builder = new StringBuilder();

            foreach (var track in response.Tracks)
            {
                builder.AppendLine($"[{string.Join(", ", track.Artists.Select(x => x.Name))} - {track.Name}]({string.Format(SpotifyConstants.TrackUrlFormat, track.Id)})");
            }

            await ReplyEmbedAsync(new EmbedBuilder()
                                  .WithTitle("Spotify Recommends")
                                  .WithDescription(builder.ToString()));
        }