Пример #1
0
        private async Task <bool> TestTopTracks(IMessage message, string body)
        {
            if (topTracksRegex.Match(body).Success)
            {
                XDocument xml = await new LastFmClient(this.config[Common.Constants.ConfigKey.LastFmApiKey]).GetTopTracksAsync();
                await backend.SendMessageAsync(message.ReplyTo, LastFmResponse.CreateTopTracksResponse(xml));

                return(true);
            }
            return(false);
        }
Пример #2
0
        private async Task <bool> TestHelp(IMessage message, string body)
        {
            var helpMatch = helpRegex.Match(body);

            if (helpMatch.Success)
            {
                await backend.SendMessageAsync(message.ReplyTo, LastFmResponse.CreateHelpResponse(config.Name));

                return(true);
            }
            return(false);
        }
Пример #3
0
        private async Task <bool> TestTopAlbumsByArtist(IMessage message, string body)
        {
            if (topAlbumsByArtistRegex.Match(body).Success)
            {
                string    artist = topAlbumsByArtistRegex.Match(body).Groups[1].Value;
                XDocument xml    = await new LastFmClient(this.config[Common.Constants.ConfigKey.LastFmApiKey]).GetArtistTopAlbumsAsync(artist);
                await backend.SendMessageAsync(message.ReplyTo, LastFmResponse.CreateTopAlbumsResponse(xml, artist, false, 10));

                return(true);
            }
            return(false);
        }
Пример #4
0
        private async Task <bool> TestSimilarArtists(IMessage message, string body)
        {
            var similarArtistMatch = similarArtistRegex.Match(body);

            if (similarArtistMatch.Success)
            {
                string    artist = similarArtistMatch.Groups[1].Value;
                XDocument xml    = await new LastFmClient(this.config[Common.Constants.ConfigKey.LastFmApiKey]).GetSimilarArtistsAsync(artist);
                await backend.SendMessageAsync(message.ReplyTo, LastFmResponse.CreateSimilarArtistsResponse(xml));

                return(true);
            }
            return(false);
        }