Fix weather command properly.......
This commit is contained in:
parent
3927b7905b
commit
f5714cb90d
2 changed files with 2 additions and 2 deletions
|
@ -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`)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue