ButtonBuilder.setEmoji() Error

C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@sapphire\shapeshift\dist\index.js:1182
return Result.err(new ValidationError("s.object(T)", `Expected the value to be an object, but received ${typeOfValue} instead`, value));
^

ValidationError: Expected the value to be an object, but received string instead
at ObjectValidator.handle (C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@sapphire\shapeshift\dist\index.js:1182:25)
at ObjectValidator.parse (C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@sapphire\shapeshift\dist\index.js:142:88)
at ButtonBuilder.setEmoji (C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@discordjs\builders\dist\index.js:505:38)
at Object.execute (C:\Users\Private's PC\VisualStudioProjects\NvS\commands\games\gayrate.js:71:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
validator: 's.object(T)',
given: 'šŸ”'
}
C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@sapphire\shapeshift\dist\index.js:1182
return Result.err(new ValidationError("s.object(T)", `Expected the value to be an object, but received ${typeOfValue} instead`, value));
^

ValidationError: Expected the value to be an object, but received string instead
at ObjectValidator.handle (C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@sapphire\shapeshift\dist\index.js:1182:25)
at ObjectValidator.parse (C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@sapphire\shapeshift\dist\index.js:142:88)
at ButtonBuilder.setEmoji (C:\Users\Private's PC\VisualStudioProjects\NvS\node_modules\@discordjs\builders\dist\index.js:505:38)
at Object.execute (C:\Users\Private's PC\VisualStudioProjects\NvS\commands\games\gayrate.js:71:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
validator: 's.object(T)',
given: 'šŸ”'
}
What's the change with ButtonBuilder.setEmoji()?
10 Replies
probablyraging
probablyragingā€¢2y ago
setEmoji() takes an object not a string, show code
Noby
Nobyā€¢2y ago
It's a string now, but that's strange because my buttons on other commands with emoji strings work. I'll make the change Why is it taking Emoji ID now? What do I do if it's a like regular emoji (non-discord) emoji
const reload_button = new ButtonBuilder()
.setLabel("Play Again")
.setEmoji("šŸ”")
.setStyle(ButtonStyle.Success)
.setCustomId("gayrate_reload_button")
const reload_button = new ButtonBuilder()
.setLabel("Play Again")
.setEmoji("šŸ”")
.setStyle(ButtonStyle.Success)
.setCustomId("gayrate_reload_button")
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
probablyraging
probablyragingā€¢2y ago
Try with setEmoji({ id: 'the_id_of_emoji' })
Noby
Nobyā€¢2y ago
Is the codepoint the "id" of the emoji?
Noby
Nobyā€¢2y ago
It isn't a discord native emoji
probablyraging
probablyragingā€¢2y ago
So I just tested, for regular emojis you use the ascii version, for custom emojis you use the object with the id of the emoji But no, codepoint is the unicode šŸ” This is the ascii Which it looks like you're already using
Noby
Nobyā€¢2y ago
so for ID just use the string of the emoji?
probablyraging
probablyragingā€¢2y ago
No, sorry I explained that poorly. This is how I just tested it For regular emojis, use
.setEmoji({ name: 'šŸ”' })
.setEmoji({ name: 'šŸ”' })
For custom emojis, use
.setEmoji({ id: '3534534534534' })
.setEmoji({ id: '3534534534534' })
Sorry, it's late, I'm tired šŸ˜„
.setEmoji('šŸ”')
.setEmoji('šŸ”')
Should also work, but in your case it doesn't and I'm not sure why, but hopefully this help
Noby
Nobyā€¢2y ago
Sick, thanks dm