discord.js - Imagine ❄d-I❄
discord.js - Imagine ❄17mo ago
22 replies
cloud

can send normal message but cant send embded message

try {
    // Send DM to the user with the LeetCode question
    await member.user.send(
      `You have been timed out in ${member.guild.name}. To get your timeout removed, solve this LeetCode question and reply with submission link or screenshot: ${randomLeetCodeQuestion}`,
    );
    console.log(`Successfully sent LeetCode question to ${member.user.tag}`);
    const redirectChannel = member.guild.channels.cache.get(
      config.LEETCODE_LOGS_CHANNEL_ID,
    );
    await redirectChannel.send(
      `Successfully sent LeetCode question to ${member.user.tag}`,
    );
  } catch (error) {
    console.error(`Failed to send DM to ${member.user.tag}:`, error);
  }
this code works
Was this page helpful?