mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -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 { editOrReply } = require('../../../labscore/utils/message')
|
||||||
|
|
||||||
const { darksky } = require('../../../labscore/api');
|
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");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
|
||||||
|
@ -26,14 +26,16 @@ 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${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 = [];
|
let secondaryPills = [];
|
||||||
if(data.result.current.humidity > 0) secondaryPills.push(`${pill("Humidity")} ${smallPill(Math.floor(data.result.current.humidity * 100) + "%")}`)
|
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(`${pill("UV Index")} ${smallPill(data.result.current.uvindex)}`)
|
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(` `)
|
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
|
// Render Forecasts
|
||||||
description += `\n`
|
description += `\n`
|
||||||
for(const i of data.result.forecast){
|
for(const i of data.result.forecast){
|
||||||
|
|
11
index.js
11
index.js
|
@ -38,10 +38,11 @@ const manager = new ClusterManager(client, token, {
|
||||||
await manager.run();
|
await manager.run();
|
||||||
console.log(`v2 | ready. took ${(Date.now() - time) / 1000}.`)
|
console.log(`v2 | ready. took ${(Date.now() - time) / 1000}.`)
|
||||||
|
|
||||||
let liveDeploy = await superagent.get(`${process.env.PB_MANAGER_HOST}_pbs/GetPbServiceId`)
|
if(process.env.environment == "prodnew"){
|
||||||
if(process.env.environment == "prodnew" && process.env.HOSTNAME !== liveDeploy.body.d){
|
let liveDeploy = await superagent.get(`${process.env.PB_MANAGER_HOST}_pbs/GetPbServiceId`)
|
||||||
console.log(`[${process.env.HOSTNAME}] invalid deployment session`)
|
if(process.env.HOSTNAME !== liveDeploy.body.d){
|
||||||
process.exit();
|
console.log(`[${process.env.HOSTNAME}] invalid deployment session`)
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
|
@ -191,7 +191,13 @@ module.exports.REDESIGN_ICONS = Object.freeze({
|
||||||
|
|
||||||
"generative_ai": "<:ico_generative_ai:1165258096227135498>",
|
"generative_ai": "<:ico_generative_ai:1165258096227135498>",
|
||||||
"latency": "<:ico_latency:1165258097338630235>",
|
"latency": "<:ico_latency:1165258097338630235>",
|
||||||
"thermometer": "<:ico_thermometer:1167576335133200414>",
|
|
||||||
|
"moon": "<:ico_w_moon:1168187409662480405> ",
|
||||||
|
"raindrop": "<:ico_w_raindrop:1168187412170690592> ",
|
||||||
|
"sun": "<:ico_w_sun:1168187414234275981> ",
|
||||||
|
"thermometer": "<:ico_w_thermometer:1168187416595677314> ",
|
||||||
|
"thermometer_cold": "<:ico_w_thermometer_cold:1168187418139164692> ",
|
||||||
|
"wind": "<:ico_w_wind:1168187419594604665> ",
|
||||||
|
|
||||||
"exclaim_0": "<:ico_exclaim_0:1165263543583649842>",
|
"exclaim_0": "<:ico_exclaim_0:1165263543583649842>",
|
||||||
"exclaim_1": "<:ico_exclaim_1:1165263545747914853>",
|
"exclaim_1": "<:ico_exclaim_1:1165263545747914853>",
|
||||||
|
@ -201,6 +207,7 @@ module.exports.REDESIGN_ICONS = Object.freeze({
|
||||||
"question_large": "<:ico_question_large:1165263553050185950>",
|
"question_large": "<:ico_question_large:1165263553050185950>",
|
||||||
|
|
||||||
"weather_clear": "<:ico_weather_clear_day:1167770009557286913>",
|
"weather_clear": "<:ico_weather_clear_day:1167770009557286913>",
|
||||||
|
"weather_clear_night": "<:ico_weather_clear_night:1168183604409544714>",
|
||||||
"weather_cloudy": "<:ico_weather_cloudy:1167770011776073819>",
|
"weather_cloudy": "<:ico_weather_cloudy:1167770011776073819>",
|
||||||
"weather_drizzle": "<:ico_weather_drizzle:1167770013747388437>",
|
"weather_drizzle": "<:ico_weather_drizzle:1167770013747388437>",
|
||||||
"weather_flurries": "<:ico_weather_flurries:1167788306059247616>",
|
"weather_flurries": "<:ico_weather_flurries:1167788306059247616>",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue