mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
weather v2, p4
This commit is contained in:
parent
1ffa186256
commit
54c351c1a3
2 changed files with 13 additions and 4 deletions
|
@ -5,6 +5,7 @@ const { darksky } = require('../../../labscore/api');
|
|||
const { pill, iconPill, smallIconPill, smallPill, icon, weatherIcon, timestamp } = require('../../../labscore/utils/markdown');
|
||||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
const { STATICS } = require('../../../labscore/utils/statics');
|
||||
|
||||
module.exports = {
|
||||
name: 'weather',
|
||||
|
@ -26,15 +27,15 @@ 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${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 description = `### ${weatherIcon(data.result.current.condition.id.toLowerCase())} ${Math.floor(data.result.current.temperature.current)}°C • ${data.result.current.condition.label}\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 secondaryPills = [];
|
||||
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(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(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")}`
|
||||
description += `\n\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`
|
||||
|
@ -53,6 +54,9 @@ module.exports = {
|
|||
timestamp: new Date(data.result.current.date)
|
||||
})
|
||||
|
||||
e.footer.iconUrl = STATICS.weather
|
||||
if(data.result.location) e.footer.text = data.result.location //+ " • " + context.client.user.username
|
||||
|
||||
if(data.result.current.icon) e.thumbnail = { url: data.result.current.icon }
|
||||
if(data.result.current.image) e.image = { url: data.result.current.image }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue