private static string GetResponseMessage( string lastfmUsername, LastfmScrobble lastfmScrobble, string spotifyUrl) { string response; string encodedUsername = HttpUtility.HtmlEncode(lastfmUsername); if (lastfmScrobble.IsNowPlaying) { response = $"<i>{encodedUsername} is currently playing</i>\n"; } else { response = $"<i>{encodedUsername} played</i>\n"; } int?userPlayCount = lastfmScrobble.LastfmTrack.UserPlayCount; response += ResponseHelper.GetResponseForTrack( lastfmScrobble.LastfmTrack, spotifyUrl, userPlayCount); response += "\n"; if (!lastfmScrobble.IsNowPlaying) { response += $"<i>on {GetTimePlayed(lastfmScrobble)}</i>"; } return(response); }
private static string GetTimePlayed(LastfmScrobble track) => track.TimePlayed?.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");