mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
weather v2 p3
This commit is contained in:
parent
97152e238f
commit
1ffa186256
3 changed files with 20 additions and 10 deletions
|
@ -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){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue