Salis
Salis
DIAdiscord.js - Imagine an app
Created by Salis on 4/8/2024 in #djs-questions
Keep getting "DiscordAPIError[50035]: Invalid Form Body tried a couple of changes but same stuff.
const { SlashCommandBuilder } = require('@discordjs/builders');
const { PermissionsBitField, ButtonStyle, ActionRowBuilder, ButtonBuilder, EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('verify')
.setDescription("Creëer een verificatie panel"),
async execute (interaction, client) {

if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) return await interaction.reply({ content: "Je moet een Administrator zijn om dit paneel te creëeren", ephemeral: true})
const button = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('button')
.setEmoji('✅')
.setLabel('Verifieer jezelf')
.setStyle(ButtonStyle.Success),
)

const embed = new EmbedBuilder()
.setColor("Blue")
.setTitle("Server verificatie")
.setDescription('Klik op de onderstaande knop om jezelf te verifiëren binnen de server.')

await interaction.reply({ embeds: [embed], components: [button] });

const collector = await interaction.channel.createMessageComponentCollector();

collector.on('collect', async i => {

await i.update({ embeds: [embed], components: [button] });

const role = interaction.guild.roles.cache.find(r => r.name === 'beldians');

const member = i.member;

member.roles.add(role);

i.user.send('Je bent nu geverifieerd in **${i.guild.name}**').catch(err => {
return;
})
})
}}
const { SlashCommandBuilder } = require('@discordjs/builders');
const { PermissionsBitField, ButtonStyle, ActionRowBuilder, ButtonBuilder, EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('verify')
.setDescription("Creëer een verificatie panel"),
async execute (interaction, client) {

if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) return await interaction.reply({ content: "Je moet een Administrator zijn om dit paneel te creëeren", ephemeral: true})
const button = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('button')
.setEmoji('✅')
.setLabel('Verifieer jezelf')
.setStyle(ButtonStyle.Success),
)

const embed = new EmbedBuilder()
.setColor("Blue")
.setTitle("Server verificatie")
.setDescription('Klik op de onderstaande knop om jezelf te verifiëren binnen de server.')

await interaction.reply({ embeds: [embed], components: [button] });

const collector = await interaction.channel.createMessageComponentCollector();

collector.on('collect', async i => {

await i.update({ embeds: [embed], components: [button] });

const role = interaction.guild.roles.cache.find(r => r.name === 'beldians');

const member = i.member;

member.roles.add(role);

i.user.send('Je bent nu geverifieerd in **${i.guild.name}**').catch(err => {
return;
})
})
}}
The error I keep receiving,
DiscordAPIError[50035]: Invalid Form Body
55.name[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async /home/container/src/handlers/slashCommand.js:49:5 {
requestBody: {
files: undefined,
json: [
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object]
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { '55': [Object] }
},
code: 50035,
status: 400,
method: 'PUT',
DiscordAPIError[50035]: Invalid Form Body
55.name[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async /home/container/src/handlers/slashCommand.js:49:5 {
requestBody: {
files: undefined,
json: [
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object], [Object], [Object], [Object],
[Object], [Object]
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { '55': [Object] }
},
code: 50035,
status: 400,
method: 'PUT',
4 replies
DIAdiscord.js - Imagine an app
Created by Salis on 4/6/2024 in #djs-questions
Requiring a specific role for a specific button.
So as I was in my testing phase, I created a ticket and noticed everyone could see the ticket. Can anyone have a look at this for me please, would mean a lot to me :)
24 replies