use setEmoji to set no emoji/ remove an emoji from a button

I normally use setEmoji({name: undefined}) when I want to not have an emoji on a button, generally for dynamic button creation. But this stopped working, and started throwing an error .setEmoji({name: undefined}) *this is what I have previously used up to now
error: DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
error: DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
unsure of why this stopped working, I also tried .setEmoji()
error: ValidationError > s.object(T)
Expected the value to be an object, but received undefined instead

Received:
| undefined
error: ValidationError > s.object(T)
Expected the value to be an object, but received undefined instead

Received:
| undefined
.setEmoji(null)
error: ValidationError > s.object(T)
Expected the value to not be null

Received:
| null
error: ValidationError > s.object(T)
Expected the value to not be null

Received:
| null
.setEmoji({})
error: DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
error: DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
I've looked on the docs and searched here and people are suggestion different variations of what I listed above, but it none of them seem to work anymore. Did this option change or get removed?
8 Replies
d.js toolkit
d.js toolkit12mo ago
- 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 OP
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
BradyDaLlama .*˖
BradyDaLlama .*˖OP12mo ago
like I said, it's mostly for dynamic stuff. Also, yes I can see that it says it didn't expect a null value. The latter three were suggestions I saw and wanted to confirm I tested. All I needed to know was if it did indeed change and if there was an alternative available
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
BradyDaLlama .*˖
BradyDaLlama .*˖OP12mo ago
it would be for things like setEmoji(condition ? emoji : null), it was how I dynamically created menus.
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
BradyDaLlama .*˖
BradyDaLlama .*˖OP12mo ago
I wasn't using null, I was using {name: undefined} which worked previously. I wasn't really asking for opinions on my style just if there was a change to that which I guess there was. I'll have to use another method
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server