Adding emotes to a select menu not working

Hello! I've got a weird issue where I get a DiscordAPIError[50035] - DiscordAPIError[50035]: Invalid Form Body when I try to add emotes to a select menu. Here's the relevant code that doesn't work:
const franchises = require(`../../cache/franchises.json`);

franchises.forEach((franchise) => {
const emoteid = FranchiseEmote[franchise.slug];

console.log(typeof emoteid);
console.log(emoteid);


selectMenu.addOptions({
label: franchise.name,
value: franchise.slug,
description: `${franchise.slug} — ${franchise.name}`,
emoji: emoteid
});
});
const franchises = require(`../../cache/franchises.json`);

franchises.forEach((franchise) => {
const emoteid = FranchiseEmote[franchise.slug];

console.log(typeof emoteid);
console.log(emoteid);


selectMenu.addOptions({
label: franchise.name,
value: franchise.slug,
description: `${franchise.slug} — ${franchise.name}`,
emoji: emoteid
});
});
and it's console output:
string
1151031468756312065
string
1151031488427606016
string
1151031470383693834
string
1151031475035176980
string
1151031472552153090
string
1151031478013153321
string
1151034889404162048
string
1151031466302648410
string
1151033370315329586
string
1151032511527387146
string
1150447291229028552
string
1151033372089536585

Sep 12, 7:56 PM | ERROR : DiscordAPIError[50035]
----------------------------------- STACK -----------------------------------
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[10].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
at handleErrors (./node_modules/@discordjs/rest/dist/index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (./node_modules/@discordjs/rest/dist/index.js:786:23)
at async _REST.request (./node_modules/@discordjs/rest/dist/index.js:1218:22)
at async ChatInputCommandInteraction.reply (./node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
string
1151031468756312065
string
1151031488427606016
string
1151031470383693834
string
1151031475035176980
string
1151031472552153090
string
1151031478013153321
string
1151034889404162048
string
1151031466302648410
string
1151033370315329586
string
1151032511527387146
string
1150447291229028552
string
1151033372089536585

Sep 12, 7:56 PM | ERROR : DiscordAPIError[50035]
----------------------------------- STACK -----------------------------------
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[10].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
at handleErrors (./node_modules/@discordjs/rest/dist/index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (./node_modules/@discordjs/rest/dist/index.js:786:23)
at async _REST.request (./node_modules/@discordjs/rest/dist/index.js:1218:22)
at async ChatInputCommandInteraction.reply (./node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
15 Replies
d.js toolkit
d.js toolkit16mo 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!
rohan
rohanOP16mo ago
References Enum file (this is a ts file that has been compiled)
/**
* This file contains the enumerations for the transaction commands.
* To compile this, type one of the following commands into the root of the project directory
*
* @option npm run compile
* @option tsc ./utils/enums/franchiseEmotes.ts
*/

/**
* @enum {FranchiseEmote} Enumerations for the franchise emotes
* @param {String} IE Ignium Esports
* @param {String} VTX Infinite Vortex
* @param {String} KC Kingdom Coffee
* @param {String} LG Light Garden
* @param {String} L7 Lucky Sevens
* @param {String} OS Omnipotent Sandwiches
* @param {String} TT DoubleTaps
* @param {String} ATO The Automata
* @param {String} PA Party Animals
* @param {String} MF The Mafia
* @param {String} SOL Solaris
* @param {String} PPI Post Plant Incorporated
*/

export enum FranchiseEmote {
IE = "1151031468756312065",
VTX = "1151031488427606016",
KC = "1151031470383693834",
LG = "1151031475035176980",
L7 = "1151031472552153090",
OS = "1151031478013153321",
TT = "1151034889404162048",
ATO = "1151031466302648410",
PA = "1151033370315329586",
MF = "1151032511527387146",
SOL = "1150447291229028552",
PPI = "1151033372089536585"
}
/**
* This file contains the enumerations for the transaction commands.
* To compile this, type one of the following commands into the root of the project directory
*
* @option npm run compile
* @option tsc ./utils/enums/franchiseEmotes.ts
*/

/**
* @enum {FranchiseEmote} Enumerations for the franchise emotes
* @param {String} IE Ignium Esports
* @param {String} VTX Infinite Vortex
* @param {String} KC Kingdom Coffee
* @param {String} LG Light Garden
* @param {String} L7 Lucky Sevens
* @param {String} OS Omnipotent Sandwiches
* @param {String} TT DoubleTaps
* @param {String} ATO The Automata
* @param {String} PA Party Animals
* @param {String} MF The Mafia
* @param {String} SOL Solaris
* @param {String} PPI Post Plant Incorporated
*/

export enum FranchiseEmote {
IE = "1151031468756312065",
VTX = "1151031488427606016",
KC = "1151031470383693834",
LG = "1151031475035176980",
L7 = "1151031472552153090",
OS = "1151031478013153321",
TT = "1151034889404162048",
ATO = "1151031466302648410",
PA = "1151033370315329586",
MF = "1151032511527387146",
SOL = "1150447291229028552",
PPI = "1151033372089536585"
}
And a link to the relevant conversation in #djs-help-v14 - https://discord.com/channels/222078108977594368/824411059443204127/1151280976438239292
rohan
rohanOP16mo ago
Doing it manually by hardcoding... When the emoji string is hardcoded (using the first value copy-pasted from the console output), it works
const franchises = require(`../../cache/franchises.json`);

franchises.forEach((franchise) => {
const emoteid = FranchiseEmote[franchise.slug];

console.log(typeof emoteid);
console.log(emoteid);


selectMenu.addOptions({
label: franchise.name,
value: franchise.slug,
description: `${franchise.slug} — ${franchise.name}`,
emoji: `1151031468756312065`
});
});
const franchises = require(`../../cache/franchises.json`);

franchises.forEach((franchise) => {
const emoteid = FranchiseEmote[franchise.slug];

console.log(typeof emoteid);
console.log(emoteid);


selectMenu.addOptions({
label: franchise.name,
value: franchise.slug,
description: `${franchise.slug} — ${franchise.name}`,
emoji: `1151031468756312065`
});
});
rohan
rohanOP16mo ago
Things I've tried - Using the emojis in the escaped format:
emoji: `:ie:1151031468756312065`;
emoji: `:ie:1151031468756312065`;
- Adding the < & > characters:
emoji: `<${FranchiseEmote[franchise.slug]}>`;
emoji: `<${FranchiseEmote[franchise.slug]}>`;
- Explicit & implicit type casting
emoji: String(FranchiseEmote[franchise.slug]);
emoji: `${FranchiseEmote[franchise.slug]}`;
emoji: String(FranchiseEmote[franchise.slug]);
emoji: `${FranchiseEmote[franchise.slug]}`;
& probably various other things @GodderE2D had the following thoughts but those didn't help either... :( - Type casting & just using the Id https://discord.com/channels/222078108977594368/824411059443204127/1151280976438239292 - Invisible characters https://discord.com/channels/222078108977594368/824411059443204127/1151283649392680981
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
rohan
rohanOP16mo ago
Yep- all those are in the server
rohan
rohanOP16mo ago
on a quick aside: how did you get that emote, you're not in the server if you're wanting to see this in person i'd be happy to hop in a VC and show my screen- this is baffling to me as well lol
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
rohan
rohanOP16mo ago
Here you can see the emotes being used and the bot in the same server ( I don't have nitro )
rohan
rohanOP16mo ago
Yep, one sec
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
rohan
rohanOP16mo ago
When using this value I get the following error
Sep 12, 8:35 PM | ERROR : DiscordAPIError[50035]
----------------------------------- STACK -----------------------------------
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[0].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[1].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[2].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[3].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[4].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[5].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[6].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[7].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[8].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
Sep 12, 8:35 PM | ERROR : DiscordAPIError[50035]
----------------------------------- STACK -----------------------------------
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[0].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[1].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[2].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[3].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[4].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[5].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[6].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[7].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
data.components[0].components[0].options[8].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
and the code:
const franchises = require(`../../cache/franchises.json`);

franchises.forEach((franchise) => {
const emoteid = FranchiseEmote[franchise.slug];

console.log(typeof emoteid);
console.log(emoteid);


selectMenu.addOptions({
label: franchise.name,
value: franchise.slug,
description: `${franchise.slug} — ${franchise.name}`,
emoji: `1150447291229028552`
});
});
const franchises = require(`../../cache/franchises.json`);

franchises.forEach((franchise) => {
const emoteid = FranchiseEmote[franchise.slug];

console.log(typeof emoteid);
console.log(emoteid);


selectMenu.addOptions({
label: franchise.name,
value: franchise.slug,
description: `${franchise.slug} — ${franchise.name}`,
emoji: `1150447291229028552`
});
});
let me try somethibng
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
rohan
rohanOP16mo ago
Yeah see above
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server