Uncaught ReferenceError ReferenceError: channel is not defined

I’m coding a discord bot that creates tickets

and I would like to know how I can send messages on the channel I just created

So I try the .then, but it doesn’t work, so I don’t understand why :/

I tried a lot of thing, just visiting the web or watching video on YouTube but no one works

Here is my code :

client.on("interactionCreate", async interaction =>  {
    if(interaction.isCommand()){
        if(interaction.commandName == "ticket"){

            const Embed = new EmbedBuilder()
                .setColor(0x0099FF)
                .setTitle('Do you need help ?')
                .setDescription('By clicking on the button,nModerators will answer your questions/reports!')
                .setFooter({ text: 'Created by Skorflex#9141', iconURL: 'https://cdn.discordapp.com/attachments/1082613588507766784/1082613661140537404/logo-transparent.png' });
            
            const row = new ActionRowBuilder()
                .addComponents(
                    new ButtonBuilder()
                        .setCustomId('button')
                        .setLabel('Open a ticket')
                        .setStyle(ButtonStyle.Primary),
                );

            await interaction.reply({ embeds: [Embed], components: [row] });

        }
    }
    if(interaction.isButton()){
        if(interaction.customId === "button"){

            const server = client.guilds.cache.get(guildId);

            

            server.channels.create({name:`ticket-${interaction.user.username}`})
            .then(channel => {
                let category = client.channels.cache.get(ticket_category);

                if (!category) throw new Error("Category channel does not exist");
                    channel.setParent(category.id);
                }).catch(console.error);

                interaction.reply({content: "Your ticket is available !", ephemeral: true})

                const Embed = new EmbedBuilder()
                .setColor(0x0099FF)
                .setTitle('Thank you for contacting support')
                .setDescription('Describe your problem')

                const row = new ActionRowBuilder()
                .addComponents(
                    new ButtonBuilder()
                        .setCustomId('closebutton')
                        .setLabel('Close the ticket')
                        .setStyle(ButtonStyle.Primary),
                );
                
                channel.send({embeds:[Embed], row:[row]})
        }
    }
})