private async Task ProcessCity(ICollection <string> availableCities, string city, string authorization) { _logger.LogInformation($"Processing a city: {city}"); if (availableCities.Contains(city)) { CityWeather weatherResponse = await _service.GetWeatherForCityAsync(city, authorization); string text = new WeatherFormat(weatherResponse).DisplayWeather(); _logger.LogInformation(text); } else { string text = WeatherFormat.NoWeather(city); _logger.LogInformation(text); } }
void WeatherSearch(ITriggerMsg e, WeatherLocation location) { if (TryGetConditions(location, out WeatherConditions cond)) { if (cond.Success) { irc.SendMessage(e.ReturnTo, WeatherFormat.IrcFormat(cond)); } else if (cond.HttpErrorIs(HttpStatusCode.NotFound)) { e.Reply("Sorry, couldn't find anything for query '{0}'.", location); } else { e.Reply(cond.Exception.Message); } } else { e.Reply(weatherError); } }