Simp-O-Matic

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

commit 565abcf3f30acbabbd65e44eb81f31af5696a17f
parent 6f2775a10dfd14ed9e98f6e4f163b7026125bd9d
Author: Demonstrandum <moi@knutsen.co>
Date:   Sat, 19 Dec 2020 16:40:40 +0000

Better date format, maybe?

Diffstat:
Mlib/commands/weather.ts | 22+++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/lib/commands/weather.ts b/lib/commands/weather.ts @@ -82,17 +82,29 @@ export default async (home_scope: HomeScope) => { const temps = [...Array(24)].map((_, n) => properties.timeseries[n].data.instant.details.air_temperature); + if (!geo_object.name) + geo_object.name = 'Somewhere'; + if (!geo_object.description) + geo_object.description = 'Someplace'; + const embed = new MessageEmbed() .setTitle(`Cannot get weather information from ${location}.`); if (properties && properties.meta) embed .setTitle( `${properties.timeseries[0].data.instant.details.air_temperature}°C`) - .setAuthor(`${new Intl.DateTimeFormat('en', - { timeZone: tz, timeZoneName: 'short', hour12: false }) - .format(new Date)}` - +` ${geo_object.name},` - +` ${geo_object.description}`, + .setAuthor(`${new Intl.DateTimeFormat('en-CA', + { timeZone: tz, + timeZoneName: 'short', + hour: 'numeric', + minute: 'numeric' + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour12: false }) + .format(new Date)},` + + ` ${geo_object.name},` + + ` ${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`)