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`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue