As you know recently discord.js has moved to v13. I try to send a message in a specific channel but it gives me an error. Here's my code:
let channel = client.channels.cache.get(CHANNEL_ID)
channel.send(`${MSG}`)
This is my error:
TypeError: Cannot read property 'send' of undefined
Please help me. I've tried finding similar topics here and the only solution I found was in typescript but I want it in javascript.
使用client.guilds.cache.get("ID").channels.cache.get("ID").send()
应该有帮助!
You could also use:
let channel = GUILD.channels.cache.get(CHANNEL_ID);
channel.send(MSG);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.