trying to create a voice channel in a parent category

I'm trying to make a slash command that when used will create a voice chat and then delete it when everyone leaves.
this works fine when creating a channel with no parent category
      // Check if this Channel where the command was used is stray
      if (!interaction.channel.parent) {
        await interaction.guild.channels.create({
          name: chosenVoiceChannelName,
          type: ChannelType.GuildVoice, 
        });
        await interaction.editReply({
          content: "Your voice channel was successfully created!",
        });
        return;
      }

but when I check if there is a parent it creates the channel on the "root" level..
        // Check if this Channel where the command was used belongs to a Category
        if (interaction.channel.parent) {
            // If the Channel where the command was used belongs to a Category,
            // create another Channel in the same Category.
            await interaction.channel.parent.guild.channels.create
            name: chosenVoiceChannelName, // The name given to the Channel by the user
            type: ChannelType.GuildVoice, // The type of the Channel created.
            });

            // If we managed to create the Channel, edit the initial response with
            // a success message
            await interaction.editReply({
            content:
                "Your voice channel was successfully created in the same category!",
            });
            return;
        }



what am I missing
Ideally I would like to use the command in a thread such as this and have it create a voice channel at the top of the category.
my test env is not setup for threads but I want it to be in the category of the threads, not in the thread.
for instance this category is called DISCORD.JS SUPPORT create a voice channel in the category

"node": "20.16.0"
"discord.js": "^14.15.3",
Was this page helpful?