I don't know how to fix it
Generally I don't know how I can define emved at the beginning.
error: TypeError: Cannot read properties of undefined (reading 'spliceFields')
24 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPEmbed actually needs to be an instance of
EmbedBuilder
to use spliceFields() method
You never actually do that in your code anywhereSo how to do it another way?
Wdym the other way? You already define embed with
let embed;
Make it an instance of EmbedBuilder before you call spliceFields() method by re-assigning embed = new EmbedBuilder();
hm
The field value is empty, log it and see what it returns
Or make use of optional chaining and provide a default value if there is none
returns nothing
Then use optional chaining and provide default value if it's undefined
how
:mdn: Optional chaining (?.)
The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called using this operator is undefined or null, the expression short circuits and evaluates to undefined instead of throwing an error.
Or you know make sure the value is actually not empty
I don't know, nothing works and I just want to remove players from the embed
Then do just that, it's basic js at this point
Field value is empty
And ? I told you to check whatever you are putting in the value if it is empty or not and then provide a default value if it is, it's basic js
If you do not know how to do that, I recommend you learn some js
^
I did it, I don't understand what you are writing now.
So I don't understand what your issue is then
I don't understand it myself I did it just like on the website and console.log returns very little I don't know what exactly you mean
Pastebin
const { SlashCommandBuilder, EmbedBuilder } = require('@discordjs/b...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
+
I'm stupid I don't understand how to do it
I can send you the whole code, but dm?
Pastebin
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits, Cha...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it will no longer expire