Beispiel #1
0
        private static async Task <string> GetChuckJoke()
        {
            var chuckClient = new ChuckClient();

            var data = await chuckClient.GetJoke();

            return(data.value);
        }
Beispiel #2
0
        private static async Task SentimentMessage(HttpClient client, string from, LuisData luisData, string searchKeywords)
        {
            string sentimentMessage;

            switch (luisData.SentimentAnalysis.Label)
            {
            case "positive":
                sentimentMessage = $"You seemed happy you should probable calm down and remember a bitcoin is worth £";
                break;

            case "negative":
                sentimentMessage = $"You seemed sad, how bout a chuck norris fact to cheer you up: ";
                break;

            default:
                sentimentMessage = $"We couldn't figure out how you were feeling... here's a quote to inspire you: ";
                break;
            }

            switch (luisData.SentimentAnalysis.Label)
            {
            case "positive":
                var coinClient = new BitcoinClient();
                var coinValue  = await coinClient.GetPrice();

                sentimentMessage = sentimentMessage + coinValue;
                break;

            case "negative":
                var chuckClient = new ChuckClient();
                var joke        = await chuckClient.GetJoke();

                sentimentMessage = sentimentMessage + ": " + joke.value;
                break;

            default:
                var quoteClient = new QuoteClient();
                var quote       = await quoteClient.GetQuote();

                sentimentMessage = sentimentMessage + " " + quote;
                break;
            }

            SendTextMessage(client, from, sentimentMessage);
        }