private async Task <string> CreateWeatherCardAsync() { var http = new HttpClient { BaseAddress = new Uri("https://free-api.heweather.net/s6/weather/") }; var client = new HeWeatherClient(http, _configuration); var weather = await client.NowAsync("西湖区"); var weather6 = weather?.HeWeather6?.FirstOrDefault(); if (weather6 != null) { return($"{{\"@context\": \"https://schema.org/extensions\",\"@type\": \"MessageCard\",\"themeColor\": \"0072C6\",\"title\": \"{weather6.basic.location},{weather6.basic.parent_city}\",\"text\": \"{weather6.now.cond_txt} {weather6.now.tmp}℃\"}}"); } return(string.Empty); }
public TeamsBot(HeWeatherClient weatherClient) { _weatherClient = weatherClient; }