"Invalid Form Body" when sendPremiumRequired is called.

Starting to get monetization on my bot but I keep getting this error every time I try to call sendPremiumRequired along with it crashing right after.
DiscordAPIError[50035]: Invalid Form Body
type[BASE_TYPE_CHOICES]: Value must be one of {1, 4, 5, 6, 7, 8, 9, 11}.
DiscordAPIError[50035]: Invalid Form Body
type[BASE_TYPE_CHOICES]: Value must be one of {1, 4, 5, 6, 7, 8, 9, 11}.
Version Info: DJS: v14.15.3 Node: 22.1.0
10 Replies
d.js toolkit
d.js toolkit4w 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!
monbrey
monbrey4w ago
Please include the error stack so we can see where this error originated At the moment this appears to be slash command response types that it expects, and it doesn't expect 10 which is PREMIUM_REQUIRED
Entrapta (vee)
node:events:498
throw er; // Unhandled 'error' event
^

DiscordAPIError[50035]: Invalid Form Body
type[BASE_TYPE_CHOICES]: Value must be one of {1, 4, 5, 6, 7, 8, 9, 11}.
at handleErrors (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/@discordjs/rest/dist/index.js:835:23)
at async _REST.request (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async ChatInputCommandInteraction.sendPremiumRequired (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:273:5)
at async Client.<anonymous> (/home/rift/Documents/GitHub/FNStats-Mongo/events/interactionCreate.js:16:13)
node:events:498
throw er; // Unhandled 'error' event
^

DiscordAPIError[50035]: Invalid Form Body
type[BASE_TYPE_CHOICES]: Value must be one of {1, 4, 5, 6, 7, 8, 9, 11}.
at handleErrors (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/@discordjs/rest/dist/index.js:835:23)
at async _REST.request (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async ChatInputCommandInteraction.sendPremiumRequired (/home/rift/Documents/GitHub/FNStats-Mongo/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:273:5)
at async Client.<anonymous> (/home/rift/Documents/GitHub/FNStats-Mongo/events/interactionCreate.js:16:13)
monbrey
monbrey4w ago
Does your bot have app monetisation enabled?
Entrapta (vee)
Yes
monbrey
monbrey4w ago
Hmm, according to un-merged docs, this is deprecated in favour of premium buttons But deprecation usually does not mean disabled
PREMIUM_REQUIRED type 10 interaction response is deprecated. Please use ButtonStyle.PREMIUM to handle purchases.
Im not sure we support this yet though, as these docs arent merged yet
Entrapta (vee)
Don't think it's there lol
No description
Entrapta (vee)
I just had this in my interactionCreate event
if (interaction.commandName === "test") {
await interaction.sendPremiumRequired();
}
if (interaction.commandName === "test") {
await interaction.sendPremiumRequired();
}
Not missing a single thing I found a way to send the upgrade button with the durable sku that I was trying to use
const { Routes } = require('discord-api-types/v10');
client.rest.post(Routes.webhook(interaction.webhook.id, interaction.webhook.token), {
body: {
content:"Content",
components:[{
type: 1,
components: [{type: 2, style: 6, sku_id: 'SKU ID'}]
}]
},
auth: true,
});
const { Routes } = require('discord-api-types/v10');
client.rest.post(Routes.webhook(interaction.webhook.id, interaction.webhook.token), {
body: {
content:"Content",
components:[{
type: 1,
components: [{type: 2, style: 6, sku_id: 'SKU ID'}]
}]
},
auth: true,
});
monbrey
monbrey4w ago
Yeah, this is documented in a PR for the Discord docs, but we dont implement features until the documentation is finalised. Its odd that the old method appears to have been blocked