cannot send private message

error code
/root/discord/node_modules/@discordjs/rest/dist/index.js:640
      throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
            ^

DiscordAPIError[50007]: Cannot send messages to this user
    at handleErrors (/root/discord/node_modules/@discordjs/rest/dist/index.js:640:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.runRequest (/root/discord/node_modules/@discordjs/rest/dist/index.js:1021:23)
    at async SequentialHandler.queueRequest (/root/discord/node_modules/@discordjs/rest/dist/index.js:862:14)
    at async REST.request (/root/discord/node_modules/@discordjs/rest/dist/index.js:1387:22)
    at async UserManager.createDM (/root/discord/node_modules/discord.js/src/managers/UserManager.js:60:18)
    at async GuildMember.send (/root/discord/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:149:18) {
  requestBody: { files: undefined, json: { recipient_id: '934834307258802176' } },
  rawError: { message: 'Cannot send messages to this user', code: 50007 },
  code: 50007,
  status: 400,
  method: 'POST',
  url: 'https://discord.com/api/v10/users/@me/channels'
}

Node.js v19.2.0


my code looks like
        const channel = interaction.channel;
        channel.members.forEach(member => {
            try {
                member.send({ embeds: [embed], components: [row] });
            } catch (err) {
                console.log(`Problem podczas wysyłania wiadomości do ${member.displayName}`);
                console.log(err);
            }
        });


i tried everything but anything isn't work
Was this page helpful?