Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit ed2b00f52fd51a476391f0a1477cbf448e951a02
parent 1ad28e89f01fd305b1d31766de2c9869798e8f3f
Author: Demonstrandum <moi@knutsen.co>
Date:   Sun,  2 Aug 2020 15:55:12 +0100

Fix met.no icon.

Diffstat:
Mlib/commands/weather.ts | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/commands/weather.ts b/lib/commands/weather.ts @@ -46,7 +46,7 @@ export default async (home_scope: HomeScope) => { return e; }; - let geocoder_json, weather_info, geo_object; + let geocoder_json, weather_info, geo_object, country_code; try { const geocoder = await fetch(`${GEOCODE_URL}&apikey=${geokey}` +`&geocode=${location}&lang=en-US`); @@ -56,6 +56,12 @@ export default async (home_scope: HomeScope) => { .GeoObjectCollection .featureMember[0].GeoObject; + country_code = geo_object + .metaDataProperty + .GeocoderMetaData + .Address + .country_code; + const lon_lat = geo_object.Point.pos.split(' '); weather_info = await fetch( `${WEATHER_URL}?lat=${lon_lat[1]}&lon=${lon_lat[0]}`); @@ -77,7 +83,8 @@ export default async (home_scope: HomeScope) => { `${properties.timeseries[0].data.instant.details.air_temperature}°C`) .setAuthor(`${date_string}` +` ${geo_object.name},` - +` ${geo_object.description}`) + +` ${geo_object.description}`, + `https://www.countryflags.io/${country_code}/shiny/64.png`) .setThumbnail( `https://api.met.no/images/weathericons/png/${properties.timeseries[0].data.next_1_hours.summary.symbol_code}.png`) .addFields( @@ -96,7 +103,7 @@ export default async (home_scope: HomeScope) => { inline: true }) .setFooter( 'Data provided by Meteorologisk institutt (met.no)', - 'https://0x0.st/ixdO.png'); + 'https://0x0.st/ixd6.png'); message.channel.send(embed); };