interaction.channel is null in DM

it works for servers, but not in direct message as 'user app'.

I already use as suggestions of others similar questions, but I am not sure what I am missing:
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.MessageContent 
    ],
    partials: ['MESSAGE', 'CHANNEL', 'REACTION']

});

command is as follow:
const { ContextMenuCommandBuilder, ApplicationCommandType, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');

module.exports = {
    data: new ContextMenuCommandBuilder()
        .setName('Translate It v2')
        .setType(ApplicationCommandType.Message),

    async execute(interaction) {
        const row = new ActionRowBuilder()
            .addComponents(
                new ButtonBuilder()
                    .setCustomId('translate-en')
                    .setLabel('Translate to English')
                    .setStyle(ButtonStyle.Primary),
                new ButtonBuilder()
                    .setCustomId('translate-es')
                    .setLabel('Translate to Spanish')
                    .setStyle(ButtonStyle.Primary)
            );

        await interaction.reply({ content: 'Choose the language to translate:', components: [row], ephemeral: true });
        try {
            const filter = i => i.user.id === interaction.user.id;
            const buttonInteraction = await interaction.channel.awaitMessageComponent({ filter, time: 15000 });
...
Was this page helpful?