#Invalid form body
1 messages · Page 1 of 1 (latest)
DiscordAPIError[50035]: Invalid Form Body
name[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (C:\Users\tom\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\tom\node_modules\@discordjs\rest\dist\index.js:1021:23)
at async SequentialHandler.queueRequest (C:\Users\tom\node_modules\@discordjs\rest\dist\index.js:862:14)
at async REST.request (C:\Users\tom\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async GuildChannelManager.create (C:\Users\tom\node_modules\discord.js\src\managers\GuildChannelManager.js:170:18) {
requestBody: {
files: undefined,
json: {
name: undefined,
topic: undefined,
type: undefined,
nsfw: undefined,
bitrate: undefined,
user_limit: undefined,
parent_id: undefined,
position: undefined,
permission_overwrites: undefined,
rate_limit_per_user: undefined,
rtc_region: undefined,
video_quality_mode: undefined,
available_tags: undefined,
default_reaction_emoji: undefined,
default_auto_archive_duration: undefined,
default_sort_order: undefined,
default_forum_layout: undefined
}
},
rawError: {
code: 50035,
errors: {
name: {
_errors: [
{
code: 'BASE_TYPE_REQUIRED',
message: 'This field is required'
}
]
}
},
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/guilds/1112842609161932941/channels'
}
Any idea where this error occurs? I’m very bad at debugging invalid body forms
a channel
2 sec I’ll post my channel creation code
function createChannel(name, type, parent) {
interaction.guild.channels.create(name, {
type: type,
parent: parent,
permissionOverwrites: [
{
id: interaction.guild.roles.everyone.id,
deny: [PermissionsBitField.Flags.ViewChannel]
},
{
id: interaction.user.id,
allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.AttachFiles,PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.AddReactions, PermissionsBitField.Flags.AttachFiles, PermissionsBitField.Flags.EmbedLinks, PermissionsBitField.Flags.ReadMessageHistory, PermissionsBitField.Flags.UseExternalEmojis, PermissionsBitField.Flags.Connect, PermissionsBitField.Flags.Speak, PermissionsBitField.Flags.Stream]
}
]
})
}
createChannel(`${button}-${interaction.user.username}`, ChannelType.GuildText, '1112842609161932946')```
wherever you call your method you're not passing in any of the params
All variables are defined, this is just a snippet of all channel related creations
none of the variables are defined, not even your overwrites
the name goes inside the object
oh yep thats it indeed
GuildChannelManager#create()
Creates a new channel in the guild.
always confuse .edit and .create
yup it happens
the name option goes inside the object
Oh inside the create?
yes
please look at this for future reference
.create({name: "", ...})
yep
Yeah I was reading the doc, copilot might of taken it a bit weird dD
Time to test
It worked !!!!
Tyvm
I’m making a fully customizable ticket system without webpanel. It’s rough lmao but I’m about 75% of the way done
formbodies arent really difficult to debug. If you see undefined on every property that should already alert you. the url can also be used to see what you are doing, if you POST a request to /channels, it has something to do with creating a channel