Error: TypeError: Cannot read properties of undefined (reading 'channels')

41 views Asked by At

(Apologize for my english) Hey, I wanted to create a channel after command executes. After executing command, it shows me the error

TypeError: Cannot read properties of undefined (reading 'channels')

My ticket.js code below

const {
    Client,
    SlashCommandBuilder,
    PermissionFlagsBits,
    GatewayIntentBits
} = require('discord.js');

const client = new Client({
    intents: [GatewayIntentBits.Guilds]
});

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ticket')
        .setDescription('Utwórz ticketa'),
    async execute(interaction, client) {
        interaction.guild.channels.create({
            name: `ticket`,
            type: ChannelType.GuildText,
            parent: cat[0].ID
            // your permission overwrites or other options here

        });

    }
};

0

There are 0 answers