Problem while creating category

i have a problem while creating channel is specific category. Sometime one of the two category i'm creating (the first one, "travel_category") is not created so when i assign a channel in this category, i have an error. But sometime it works just fine, the cateogry is created and everything works. Here's the code:
            const travel_category = await interaction.guild.channels.create({name: "traveler", type: ChannelType.GuildCategory });
            const main_category = await interaction.guild.channels.create({name: "main", type: ChannelType.GuildCategory });
        

            sleep(1000)


            welcome_channel = await interaction.guild.channels.create({ 
                name: arriving_emoji + "・Welcome",
                type: ChannelType.GuildText, // syntax has changed a bit
                permissionOverwrites: [{ // same as before
                    id: interaction.guild.id,
                    allow: [PermissionFlagsBits.ViewChannel],
                    deny: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.CreatePrivateThreads, PermissionFlagsBits.CreatePublicThreads]
                }]
            });
            welcome_channel.setParent(travel_category.id)

thx
Was this page helpful?