Embed Weather

/shrug
This commit is contained in:
Kevin 2016-11-29 15:26:13 -05:00 committed by GitHub
parent 25e31faa6e
commit c7b2d753c3

View File

@ -42,13 +42,38 @@ namespace NadekoBot.Modules.Searches
response = await http.GetStringAsync($"http://api.ninetales.us/nadekobot/weather/?city={city}&country={country}").ConfigureAwait(false); response = await http.GetStringAsync($"http://api.ninetales.us/nadekobot/weather/?city={city}&country={country}").ConfigureAwait(false);
var obj = JObject.Parse(response)["weather"]; var obj = JObject.Parse(response)["weather"];
double centiLucy = Double.Parse(obj["feelscentigrade"].ToString());
uint[] colLucy = { 0x0000FF, 0xADD8E6, 0xFF0000, 0x8A8A8A};
int colBaby = 0;
if (centiLucy < -49)
{
colBaby = 0;
} else if (centiLucy > -1 && centiLucy < 1)
{
colBaby = 1;
} else if (centiLucy > 49)
{
colBaby = 2;
} else {
colBaby = 3;
}
await channel.SendMessageAsync( var embed = new EmbedBuilder()
$@"🌍 **Weather for** 【{obj["target"]}】 .WithAuthor(eau => eau.WithName("Lucy's Forecast Today")
📏 **Lat,Long:** ({obj["latitude"]}, {obj["longitude"]}) **Condition:** {obj["condition"]} .WithIconUrl("http://icons.iconarchive.com/icons/wineass/ios7-redesign/512/Weather-icon.png"))
😓 **Humidity:** {obj["humidity"]}% 💨 **Wind Speed:** {obj["windspeedk"]}km/h / {obj["windspeedm"]}mph .WithDescription("\0")
🌡 **Temperature:** {obj["centigrade"]}°C / {obj["fahrenheit"]}°F 🔆 **Feels like:** {obj["feelscentigrade"]}°C / {obj["feelsfahrenheit"]}°F .AddField(fb => fb.WithName("🌍 **Weather for:**").WithValue($"{obj["target"]}").WithIsInline(true))
🌄 **Sunrise:** {obj["sunrise"]} 🌇 **Sunset:** {obj["sunset"]}").ConfigureAwait(false); .AddField(fb => fb.WithName("📏 **Lat,Long:**").WithValue($"{obj["latitude"]}, {obj["longitude"]}").WithIsInline(true))
.AddField(fb => fb.WithName("☁ **Condition:**").WithValue($"{obj["condition"]}").WithIsInline(true))
.AddField(fb => fb.WithName("😓 **Humidity:**").WithValue($"{obj["humidity"]}%").WithIsInline(true))
.AddField(fb => fb.WithName("💨 **Wind Speed:**").WithValue($"{obj["windspeedk"]}km/h / {obj["windspeedm"]}mph").WithIsInline(true))
.AddField(fb => fb.WithName("🌡 **Temperature:**").WithValue($"{obj["centigrade"]}°C / {obj["fahrenheit"]}°F").WithIsInline(true))
.AddField(fb => fb.WithName("🔆 **Feels like:**").WithValue($"{obj["feelscentigrade"]}°C / {obj["feelsfahrenheit"]}°F").WithIsInline(true))
.AddField(fb => fb.WithName("🌄 **Sunrise:**").WithValue($"{obj["sunrise"]}").WithIsInline(true))
.AddField(fb => fb.WithName("🌇 **Sunset:**").WithValue($"{obj["sunset"]}").WithIsInline(true))
.WithColor(colLucy[colBaby])
.WithTimestamp(DateTime.Now);
await channel.SendMessageAsync("-", embed: embed.Build()).ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]