Weird DJS err... something about cannot use 'in' operator to search for color?

This is my command: https://srcb.in/832iYRGVCa I saw that we can now use embed objects here: https://discordjs.guide/popular-topics/embeds.html#using-the-embed-constructor So I updated the way I wrote my commands. I just uninstalled and reinstalled DJS to make sure it wasn't an issue. It now shows I'm on 13.8.1. Node is v16.15.0 and npm is 8.12.1. Exact err:
bot/node_modules/discord.js/src/structures/MessageEmbed.js:84
this.color = 'color' in data ? Util.resolveColor(data.color) : null;
^

TypeError: Cannot use 'in' operator to search for 'color' in
at MessageEmbed.setup (/root/bot/node_modules/discord.js/src/structures/MessageEmbed.js:84:26)
at new MessageEmbed (/root/bot/node_modules/discord.js/src/structures/MessageEmbed.js:44:10)
at /root/bot/node_modules/discord.js/src/structures/MessagePayload.js:201:49
at Array.map (<anonymous>)
at MessagePayload.resolveData (/root/bot/node_modules/discord.js/src/structures/MessagePayload.js:201:36)
at DMChannel.send (/root/bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:61)
at User.send (/root/bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:164:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
bot/node_modules/discord.js/src/structures/MessageEmbed.js:84
this.color = 'color' in data ? Util.resolveColor(data.color) : null;
^

TypeError: Cannot use 'in' operator to search for 'color' in
at MessageEmbed.setup (/root/bot/node_modules/discord.js/src/structures/MessageEmbed.js:84:26)
at new MessageEmbed (/root/bot/node_modules/discord.js/src/structures/MessageEmbed.js:44:10)
at /root/bot/node_modules/discord.js/src/structures/MessagePayload.js:201:49
at Array.map (<anonymous>)
at MessagePayload.resolveData (/root/bot/node_modules/discord.js/src/structures/MessagePayload.js:201:36)
at DMChannel.send (/root/bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:61)
at User.send (/root/bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:164:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I have no idea what this is referring to.
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
2 Replies
Squid
Squid2y ago
user.send({ text: 'These are all of our server's rules:', embeds: [text], component: [buttons] });
This is wrong for 3 reasons: 1. text is not a valid message option, but content is 2. The text variable is an empty string, not an embed, so you can't send it as an embed 3. component should be components (with an s) And some of those reasons are also in other lines in that file
Erin
Erin2y ago
Yup, that was the issue. Thank you!