public override object CommandHandler(SocketMessage socketMessage, string input, CommandArguments arguments) { if (input.Length == 0) { return("Please enter a location to check weather."); } WeatherData data = WeatherApi.GetWeatherInLocation(input); if (data.CallbackCode != 200) { return("Error fetching data from API, please try again later"); } EmbedBuilder embed = new EmbedBuilder() { Color = ParentManager.bot.BotColor, Title = "Current weather for " + (new CultureInfo("en-US", false).TextInfo.ToTitleCase(data.Location)) + " :flag_" + data.LocationInfo.Country.ToLower() + ":", ThumbnailUrl = string.Format("http://openweathermap.org/img/wn/{0}@2x.png", data.Info[0].Icon), Description = "Condition: " + data.Info[0].Main, Fields = new List <EmbedFieldBuilder>() { new EmbedFieldBuilder() { Name = "Temperature", Value = "" + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.TemperatureKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Celsius), 1) + "°C / " + "" + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.TemperatureKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Fahrenheit), 1) + "°F" + "\nFeels like " + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.FeelTemperatureKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Celsius), 1) + "°C / " + "" + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.FeelTemperatureKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Fahrenheit), 1) + "°F", IsInline = true }, new EmbedFieldBuilder() { Name = "High", Value = "" + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.TemperatureHighKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Celsius), 1) + "°C / " + "" + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.TemperatureHighKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Fahrenheit), 1) + "°F", IsInline = true }, new EmbedFieldBuilder() { Name = "Low", Value = "" + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.TemperatureLowKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Celsius), 1) + "°C / " + "" + Mathf.Round(WeatherApi.ConvertTemperature(data.Air.TemperatureLowKelvin, WeatherApi.TemperatureType.Kelvin, WeatherApi.TemperatureType.Fahrenheit), 1) + "°F", IsInline = true }, new EmbedFieldBuilder() { Name = "Air Pressure", Value = "" + data.Air.AirPressure + "hPa", IsInline = true }, new EmbedFieldBuilder() { Name = "Humidity", Value = "" + Mathf.Round(data.Air.AirHumidity, 1) + "%", IsInline = true }, new EmbedFieldBuilder() { Name = "Visibility", Value = (data.ViewDistance >= 1000?Mathf.Round(data.ViewDistance / 1000f, 0) + "km":data.ViewDistance + "m"), IsInline = true } } }; return(embed); }