I am getting this error on the code below:
(node:13760) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
bot.on('message', async (message) => {
message
.delete({ timeout: 10 })
.catch((err) =>
logger.error(`Could not delete message (Error: ${err.message})`),
);
// Checking if command was executed in report channel
if (message.channel.name != 'from-user') {
// Do nothing
logger.info(
`message has not been sent in the forwarding channel! Aborting request.`,
);
} else {
if (message.author.bot) return;
await client.channels.cache.get('910109122572218378').send(message.content);
console.log(message.content); // log messages
return;
}
});