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

612
Vistas
Error - TypeError: client.on is not a function (Discord.js)

I get this error:

Client.on("guildCreate", (guild) => {       
TypeError: Client.on is not a function

My code is:

const client = require("../index");
const { MessageEmbed } = require("discord.js");

client.on("guildCreate", (guild) => {
    let channelToSend;

    guild.channels.cache.forEach((channel) => {
        if (

            channel.type === "text" &&
            !channelToSend &&
            channel.permissionsFor(guild.me).has("SEND_MESSAGES")

        ) channelToSend = channel;
    });

    if(!channelToSend) return;

    channelToSend.send(
        new MessageEmbed()
            .setAuthor(guild.name, guild.iconURL({ dynamic: true }))
            .setDescription("Thanks for inviting me my prefix is '?'")
            .setColor("RANDOM")
            .setTimestamp()

    )


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

0

You are not creating the client correctly.

The official documentation said to do that for creating the client:

const { Client } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
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