Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
(discord.js) TypeError: Cannot read property 'send' of undefined when trying to send a direct message

I have two text files, one with discord usernames with #, and another with the same amount of unique urls. I'm trying to make a discord bot to send each person one of the unique urls. I have run into an issue trying to send a test dm to one person. I keep getting the error.

TypeError: Cannot read property 'send' of undefined

    // Require the necessary discord.js classes
    const { Client, Intents } = require('discord.js');
    const { token } = require('./config.json');

    // Create a new client instance
    const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

    // When the client is ready, run this code (only once)
    client.once('ready', () => {
        console.log('Ready');
        client.users.cache.get('877248726085828720').send('yo');
    });

    // Login to Discord with your client's token
    client.login(token);

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Soo at the begining I think that you lose one intend so search them in API Documentation Discord.js Second I don't really understand where yiu want to send message but it should look like this

client.channels.cache.get('idhere').send('message');

I hope that helps you. Give me feedback if it does.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda