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ā€¢3y ago
setEmoji() takes an object not a string, show code
noby
nobyOPā€¢3y 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ā€¢3y ago
Message Not Public
Sign In & Join Server To View
probablyraging
probablyragingā€¢3y ago
Try with setEmoji({ id: 'the_id_of_emoji' })
noby
nobyOPā€¢3y ago
Is the codepoint the "id" of the emoji?
noby
nobyOPā€¢3y ago
It isn't a discord native emoji
probablyraging
probablyragingā€¢3y 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
nobyOPā€¢3y ago
so for ID just use the string of the emoji?
probablyraging
probablyragingā€¢3y 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
nobyOPā€¢3y ago
Sick, thanks dm
Want results from more Discord servers?
Add your server