Creating new category/channel error

Hi I keep getting this error:
DiscordAPIError[50035]: Invalid Form Body
name[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (/Users//Documents/Cosmic/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/Users//Documents/Cosmic/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/Users//Documents/Cosmic/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request(/Users//Documents/Cosmic/discordBot.js:27:9) {
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,
default_thread_rate_limit_per_user: undefined,
available_tags: undefined,
default_reaction_emoji: undefined,
default_auto_archive_duration: undefined,
default_sort_order: undefined,
default_forum_layout: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { name: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/guilds/1140352024639193200/channels'
}
DiscordAPIError[50035]: Invalid Form Body
name[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (/Users//Documents/Cosmic/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/Users//Documents/Cosmic/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/Users//Documents/Cosmic/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request(/Users//Documents/Cosmic/discordBot.js:27:9) {
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,
default_thread_rate_limit_per_user: undefined,
available_tags: undefined,
default_reaction_emoji: undefined,
default_auto_archive_duration: undefined,
default_sort_order: undefined,
default_forum_layout: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { name: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/guilds/1140352024639193200/channels'
}
with this code:
js
let sellCategory = interaction.guild.channels.cache.find(c => c.name === "Sell Information" && c.type === "GUILD_CATEGORY");
if (!sellCategory) {
console.log('Working 3')
sellCategory = await interaction.guild.channels.create("Sell Information", {
type: "GUILD_CATEGORY",
});
console.log('Working 4')
}
js
let sellCategory = interaction.guild.channels.cache.find(c => c.name === "Sell Information" && c.type === "GUILD_CATEGORY");
if (!sellCategory) {
console.log('Working 3')
sellCategory = await interaction.guild.channels.create("Sell Information", {
type: "GUILD_CATEGORY",
});
console.log('Working 4')
}
8 Replies
d.js toolkit
d.js toolkit11mo 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!
mictony
mictonyOP11mo ago
14.14.1 (newest)
treble/luna
treble/luna11mo ago
thats v13 code
d.js docs
d.js docs11mo ago
method GuildChannelManager#create() Creates a new channel in the guild.
treble/luna
treble/luna11mo ago
also channel type is not a string
d.js docs
d.js docs11mo ago
dtypes v10: ChannelType read more
mictony
mictonyOP11mo ago
where's the method for creating categories - just see regular channels here
treble/luna
treble/luna11mo ago
same thing you just set a different channel type
Want results from more Discord servers?
Add your server