weather v2 p3

This commit is contained in:
derpystuff 2023-10-29 15:05:07 +01:00
parent 97152e238f
commit 1ffa186256
3 changed files with 20 additions and 10 deletions

View file

@ -2,7 +2,7 @@ const { createEmbed } = require('../../../labscore/utils/embed')
const { editOrReply } = require('../../../labscore/utils/message')
const { darksky } = require('../../../labscore/api');
const { pill, iconPill, smallIconPill, smallPill, icon, weatherIcon } = require('../../../labscore/utils/markdown');
const { pill, iconPill, smallIconPill, smallPill, icon, weatherIcon, timestamp } = require('../../../labscore/utils/markdown');
const { Permissions } = require("detritus-client/lib/constants");
@ -26,14 +26,16 @@ module.exports = {
data = data.response.body
let description = `### ${weatherIcon(data.result.current.condition.id.toLowerCase())} ${Math.floor(data.result.current.temperature.current)}°C • ${data.result.current.condition.label}\n${data.result.location}\n\n${pill("Feels like")} ${smallPill(Math.floor(data.result.current.temperature.feels_like) + "°C")} ${pill("Wind")} ${smallPill(data.result.current.wind.speed + " km/h")}`
let description = `### ${weatherIcon(data.result.current.condition.id.toLowerCase())} ${Math.floor(data.result.current.temperature.current)}°C • ${data.result.current.condition.label}\n${data.result.location}\n\n${iconPill("thermometer", "Feels like")} ${smallPill(Math.floor(data.result.current.temperature.feels_like) + "°C")}\n${iconPill("wind", "Wind")} ${smallPill(data.result.current.wind.speed + " km/h")}`
let secondaryPills = [];
if(data.result.current.humidity > 0) secondaryPills.push(`${pill("Humidity")} ${smallPill(Math.floor(data.result.current.humidity * 100) + "%")}`)
if(data.result.current.uvindex > 0) secondaryPills.push(`${pill("UV Index")} ${smallPill(data.result.current.uvindex)}`)
if(data.result.current.humidity > 0) secondaryPills.push(`${iconPill("raindrop", "Humidity")} ${smallPill(Math.floor(data.result.current.humidity * 100) + "%")}`)
if(data.result.current.uvindex > 0) secondaryPills.push(`${iconPill("sun", "UV Index")} ${smallPill(data.result.current.uvindex)}`)
if(secondaryPills.length >= 1) description += '\n' + secondaryPills.join(` `)
description += `\n${iconPill("sun", "Sunrise")} ${timestamp(data.result.current.sun.sunrise, "t")} ${iconPill("moon", "Sunset")} ${timestamp(data.result.current.sun.sunset, "t")}`
// Render Forecasts
description += `\n`
for(const i of data.result.forecast){