From f5714cb90dca9cbcd51387bc91a21131dae9babf Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Wed, 6 Dec 2023 17:49:34 +0100 Subject: [PATCH] Fix weather command properly....... --- commands/misc/weather.js | 2 +- util/getWeather.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/misc/weather.js b/commands/misc/weather.js index 9b3eaa8..3b4746e 100644 --- a/commands/misc/weather.js +++ b/commands/misc/weather.js @@ -20,7 +20,7 @@ module.exports = { // convert °C to °F and add it after C temperature in parentheses let tempRegex = /(-?\d+)(?=°C)/g; - if(weather.success){ + if(weather?.success){ let tempInCelsius = weather.weather.match(tempRegex)[0]; let tempInFahrenheit = Math.round(tempInCelsius * 1.8 + 32); weather.weather = weather.weather.replace("°C", `°C (${tempInFahrenheit})°F`) diff --git a/util/getWeather.js b/util/getWeather.js index a774c9b..96a9c46 100644 --- a/util/getWeather.js +++ b/util/getWeather.js @@ -4,7 +4,7 @@ module.exports = async function (location) { const options = { hostname: "wttr.in", port: 443, - path: `${location}?format=4&M`, + path: `/${location}?format=4&M`, method: 'GET', timeout: 5000 }