JSFiddle - React, Tailwind, and code Playground

by Mladen Mihajlovic

JavaScript

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
  // Get a list of the user's DM channels
  const dmChannels = client.channels.cache.filter(channel => channel.type === 'dm');

  // Print the name and ID of each DM channel to the console
  dmChannels.forEach(channel => {
    console.log(`Name: ${channel.name} | ID: ${channel.id}`);
  });
});

// Replace with your bot's token
client.login('your-bot-token-here');