Client.once('ready', () => {
console.log('Bot online')
});
Client.on("message", message => {
if(message.channel.id = '915302302682873909') {
const logChannel = Client.channels.cache.find(channel => channel.id === "915302371519770664");
//send author
logChannel.send(`${message.author}` + ": ")
.then(message => console.log(`Sent message: ${message.content}`));
//send message content
logChannel.send(message.content)
.then(message => console.log(`Sent message: ${message.content}`));
}
})
If I start up my bot and send a message to see if it works, it sends the `${message.author}` + ": "
as it should but then immediately crashes saying TypeError: Cannot read properties of undefined (reading 'send')
What’s also really weird is that sometime (I couldn’t figure out when) it sends both `${message.author}` + ": "
and message.content
before crashing.