How to create a channel ?

I wrote some codes but it always shows
Cannot read properties of undefined (reading 'guilds')

But i defined it at first.like
const { SlashCommandBuilder,PermissionFlagsBits } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('create')
        .setDescription('add'),
    async execute(interaction,client) {
        const { guildId } = require('../../config/main/config.json');
        client.guilds.cache
        .get(guildId)
        .channels.create({ 
            name: 'testticket',
            reason: 'ticket',
            permissionOverwrites: [
                {
                    id: interaction.guild.roles.everyone,
                    deny: [PermissionFlagsBits.ViewChannel],
                },
            ],
        })
        .fetch();
        const newchannel = channel.id;
        await interaction.reply(` ${interaction.user.username} created a ticket at<#${newchannel}>`);
    },
};
Was this page helpful?