0

I'm trying to make my code return a message when the data requested in the JSON file daoesn't exist:

const denies = require("../deny.json")
let time = denies[message.member.user.id].time
if(time === undefined) return message.reply("no data found")

but regardless it throws the error and not sending any message

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'time' of undefined

I also tried

if(denies[message.member.user.id].time === undefined) return message.reply("no data found")

but it doesn't work either

tekeke
  • 133
  • 2
  • 15

0 Answers0