fellow Developers! I've been having a ton of issue over the past couple hours with Discord.JS's embedding technique. I keep getting:
TypeError: Cannot read property 'client' of undefined at new MessageEmbed (folder\\node_modules\\discord.js\\src\\structures\\MessageEmbed.js:13:60) at embed (folder\\rlxob.js:17:13) at Client.client.on.message(folder\\rlxob.js:193:15)
And from what I understand, the rest beyond that doesn't matter, but here's a Gyazo image if you want to see the entire output. MessageEmbed.js line 13 says Object.defineProperty(this, 'client', { value: message.client });
which is leaving me a bit confused. It seems to expect the message
variable to already be defined in class MessageEmbed {constructor (message, data) {
but my code matches up with every single tutorial on message embedding that I have checked, double-checked, and gonna find out who's naughty or nice. And this piece of... well, I have no nice words to say, so I won't say any of them. To leave you with a few bits of information that might help, node
is running on version 8.9.4
and Discord.JS
is running on version 11.2.1
. This is really getting on my nerves, there isn't a clear answer that I can figure out. Thanks for the help, guys! If you need any new information, I'll be checking back here. If I don't reply, probably means I figured it out, however unlikely that may be.
I understand you have double checked but just to make sure this is my embed that works fine:
case "info":
var embed = new Discord.RichEmbed()
.addField("General-Commands", "::games, ::people")
.addField("Other-Commands", "::example, ::gamble")
.addField(
"Music-Commands",
"::play <playlisturl>/search, ::skip, ::pause/resume, ::stop, ::queue"
);
message.channel.sendEmbed(embed);
break;
You probably didn't define Client
, so this is what you'll have to add:
const client = new Discord.Client({disableEveryone: true})
Note: {disableEveryone}
is optional.
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.