mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-10 15:13:04 -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 { pill, iconPill, smallIconPill, smallPill, icon, weatherIcon, timestamp } = require('../../../labscore/utils/markdown');
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
const { STATICS } = require('../../../labscore/utils/statics');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'weather',
|
name: 'weather',
|
||||||
|
@ -26,15 +27,15 @@ module.exports = {
|
||||||
|
|
||||||
data = data.response.body
|
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 = [];
|
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.humidity > 0) secondaryPills.push(`${pill("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.uvindex > 0) secondaryPills.push(`${pill("UV Index")} ${smallPill(data.result.current.uvindex)}`)
|
||||||
|
|
||||||
if(secondaryPills.length >= 1) description += '\n' + secondaryPills.join(` `)
|
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
|
// Render Forecasts
|
||||||
description += `\n`
|
description += `\n`
|
||||||
|
@ -53,6 +54,9 @@ module.exports = {
|
||||||
timestamp: new Date(data.result.current.date)
|
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.icon) e.thumbnail = { url: data.result.current.icon }
|
||||||
if(data.result.current.image) e.image = { url: data.result.current.image }
|
if(data.result.current.image) e.image = { url: data.result.current.image }
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,10 @@ const Statics = Object.freeze({
|
||||||
file: "brands/urbandictionary.png",
|
file: "brands/urbandictionary.png",
|
||||||
revision: 2
|
revision: 2
|
||||||
},
|
},
|
||||||
|
weather: {
|
||||||
|
file: "brands/weather.png",
|
||||||
|
revision: 2
|
||||||
|
},
|
||||||
wikihow: {
|
wikihow: {
|
||||||
file: "brands/wikihow.png",
|
file: "brands/wikihow.png",
|
||||||
revision: 1
|
revision: 1
|
||||||
|
@ -172,6 +176,7 @@ module.exports.STATICS = Object.freeze({
|
||||||
reddit: staticAsset(Statics.brands.reddit),
|
reddit: staticAsset(Statics.brands.reddit),
|
||||||
tineye: staticAsset(Statics.brands.tineye),
|
tineye: staticAsset(Statics.brands.tineye),
|
||||||
urbandictionary: staticAsset(Statics.brands.urbandictionary),
|
urbandictionary: staticAsset(Statics.brands.urbandictionary),
|
||||||
|
weather: staticAsset(Statics.brands.weather),
|
||||||
wikihow: staticAsset(Statics.brands.wikihow),
|
wikihow: staticAsset(Statics.brands.wikihow),
|
||||||
wikipedia: staticAsset(Statics.brands.wikipedia),
|
wikipedia: staticAsset(Statics.brands.wikipedia),
|
||||||
wolframalpha: staticAsset(Statics.brands.wolframalpha),
|
wolframalpha: staticAsset(Statics.brands.wolframalpha),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue