adding an Emoji to a button getting "invalid emjoi"

I am trying to make a simple game of chance where you select a "shell" that something is hidden under. I want to put a shell emoji on each button but I cant figure out how too with the ButtonBuilder.setEmoji() command. I am using discord.js v14.14.1
No description
6 Replies
d.js toolkit
d.js toolkit4mo 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
d.js docs
d.js docs4mo ago
- Custom emojis: \:name:<a:name:id> - Twemojis: \:name: ➞ unicode representation - Emoji picker: WIN + . / CMD + CTRL + SPACE / CTRL + . - Right-clicking any emoji will not copy its id!
monbrey
monbrey4mo ago
🐚 \:shell: Produces the above
Nifty
Nifty4mo ago
placing that in the code
const three = new ButtonBuilder()
.setCustomId('three')
.setLabel('3')
.setEmoji({name: "\:shell:"})
.setStyle(ButtonStyle.Danger);
const three = new ButtonBuilder()
.setCustomId('three')
.setLabel('3')
.setEmoji({name: "\:shell:"})
.setStyle(ButtonStyle.Danger);
i still get the error data.components[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
Kinect3000
Kinect30004mo ago
You have to paste the literal emoji
Nifty
Nifty4mo ago
thankyou! dont know why I couldn't find that anywhere. every example i found in the docs just has an id number in a string which does not work. this works 🙂
const two = new ButtonBuilder()
.setCustomId('two')
.setLabel('2')
.setEmoji({name: '🐚'})
.setStyle(ButtonStyle.Success);
const two = new ButtonBuilder()
.setCustomId('two')
.setLabel('2')
.setEmoji({name: '🐚'})
.setStyle(ButtonStyle.Success);