Пример #1
0
        public override async Task <SkillResponse> HandleIntent(SkillRequest skillRequest, IntentRequest intentRequest,
                                                                ILambdaContext context)
        {
            var actualTrack = await SpotifyClient.GetPlayingTrackAsync();

            if (actualTrack.HasError())
            {
                return(TellWithoutEnding("There was an error with getting the current playing track"));
            }

            await SpotifyClient.SaveTrackAsync(actualTrack.Item.Id);

            return(TellWithoutEnding($"I have just saved the song: {actualTrack.Item.Name}"));
        }
Пример #2
0
        public override async Task <SkillResponse> HandleIntent(SkillRequest skillRequest, IntentRequest intentRequest,
                                                                ILambdaContext context)
        {
            var track = await SpotifyClient.GetPlayingTrackAsync();

            if (track.HasError())
            {
                return(TellWithoutEnding("There was an error getting the current playing track"));
            }

            var response = new StringBuilder();

            response.Append($"Name of the track is {track.Item.Name},");
            response.Append("by:");

            foreach (var simpleArtist in track.Item.Artists)
            {
                response.Append(simpleArtist.Name);
                response.Append(",");
            }

            return(TellWithoutEnding(response.ToString()));
        }