async function sendDirectMessage(
  memberId,
  content,
) {
  let dmChannel = await cacheHandlers.get("channels", memberId);
  if (!dmChannel) {
    // If not available in cache create a new one.
    const dmChannelData = await rest.runMethod("post", endpoints.USER_DM, {
      recipient_id: memberId,
    });
    const discordenoChannel = await structures.createDiscordenoChannel(
      dmChannelData,
    );
    // Recreate the channel and add it undert he users id
    await cacheHandlers.set("channels", memberId, discordenoChannel);
    dmChannel = discordenoChannel;
  }
  // If it does exist try sending a message to this user
  return await sendMessage(dmChannel.id, content);
}
/** Send a message to a users DM. Note: this takes 2 API calls. 1 is to fetch the users dm channel. 2 is to send a message to that channel. */
Send a message to a users DM. Note: this takes 2 API calls. 1 is to fetch the users dm channel. 2 is to send a message to that channel.
Send a message to a users DM . Note : this takes 2 API calls . 1 is to fetch the users dm channel . 2 is to send a message to that channel .
async function sendDirectMessage(
  memberId,
  content,
) {
  let dmChannel = await cacheHandlers.get("channels", memberId);
  if (!dmChannel) {
    const dmChannelData = await rest.runMethod("post", endpoints.USER_DM, {
      recipient_id: memberId,
    });
    const discordenoChannel = await structures.createDiscordenoChannel(
      dmChannelData,
    );
    await cacheHandlers.set("channels", memberId, discordenoChannel);
    dmChannel = discordenoChannel;
  }
  return await sendMessage(dmChannel.id, content);
}
async function sendDirectMessage ( memberId , content , ) { let dmChannel = await cacheHandlers . get ( "channels" , memberId ) ; if ( ! dmChannel ) { const dmChannelData = await rest . runMethod ( "post" , endpoints . USER_DM , { recipient_id : memberId , } ) ; const discordenoChannel = await structures . createDiscordenoChannel ( dmChannelData , ) ; await cacheHandlers . set ( "channels" , memberId , discordenoChannel ) ; dmChannel = discordenoChannel ; } return await sendMessage ( dmChannel . id , content ) ; }
Send a message to a users DM.
Send a message to a users DM .
// If not available in cache create a new one. // Recreate the channel and add it undert he users id // If it does exist try sending a message to this user