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

131
Vistas
Detecting when a text channel is created by another bot with discord.js

I'm pretty new to javascript or discord.js but my guess was something like this:

client.on('channelCreate', channel =>
{
    message.channel.send('test');
})

I'm guessing 'channelCreate' doesn't exist.

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

0

Your guess is right.

According to the discord.js documentation, you can listen to a channelCreate event to trigger something when a channel is created.

To know who created a channel, your bot need to access the audit logs and the first entry of it.

client.on("channelCreate", async (channel) => {
  if (!channel.guild) return;

  // Fetch the audit logs of CHANNEL_CREATE events.
  const audit_logs = await channel.guild.fetchAuditLogs({
    limit: 1,
    type: "CHANNEL_CREATE"
  });

  if (!audit_logs.entries.first()) {
    console.error("No entry found.");
    return;
  }

  const entry = audit_logs.entries.first();
  const executor = entry.executor;

  // The executor property is type User,
  // so you can easily check if it's a bot by doing...
  const is_bot = executor.bot;

  // `is_bot` will be boolean.
});

Resources

  • https://discord.js.org/#/docs/discord.js/13.7.0/class/Guild?scrollTo=fetchAuditLogs
  • https://discord.js.org/#/docs/discord.js/13.7.0/class/GuildAuditLogsEntry?scrollTo=executor
  • https://discord.js.org/#/docs/discord.js/13.7.0/class/User?scrollTo=bot
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