issue with lockdown command
let data = await db.findOne({ guild: message.guild.id }).catch(err => { })
if(data.lockdown === true) { message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
})
}
else if(!data) {
let data2 = new db({
guild: message.guild.id,
lockdown: true
})
await data2.save()
} else {
db.findOneAndUpdate({ guild: message.guild.id }, { lockdown: true }).catch(err => { })
}
let data = await db.findOne({ guild: message.guild.id }).catch(err => { })
if(data.lockdown === true) { message.channel.send({embeds: [errEmbed]}).then(a => {
setTimeout(() => { message.delete(), a.delete() }, 3000)
})
}
else if(!data) {
let data2 = new db({
guild: message.guild.id,
lockdown: true
})
await data2.save()
} else {
db.findOneAndUpdate({ guild: message.guild.id }, { lockdown: true }).catch(err => { })
}
if(data.lockdown === true) { message.channel.send({embeds: [errEmbed]}).then(a => {
^
TypeError: Cannot read properties of null (reading 'lockdown')
at Object.run (C:\Users\cmart\Desktop\discord.js\Commands\Moderation\lockdown.js:15:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
if(data.lockdown === true) { message.channel.send({embeds: [errEmbed]}).then(a => {
^
TypeError: Cannot read properties of null (reading 'lockdown')
at Object.run (C:\Users\cmart\Desktop\discord.js\Commands\Moderation\lockdown.js:15:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
1 Reply
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View