Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Estoy tratando de implementar el bot de discordia en javascript al repetir, pero solo responde cuando menciono el bot en lugar de cualquier mensaje normal

He desarrollado un bot de discordia en python pero tengo problemas en javascript one.

Probé algunas soluciones de StackOverflow, pero no sé cómo hacer que funcione. Y mucha confusión debido a las soluciones disponibles en línea sobre el bot de discord y cada vez que intenta implementarlo, ya que muestra muchos errores de versión/desaprobación de nodejs y discord.

El problema es que el código de mi bot responde de la siguiente manera solo cuando los menciono, pero quiero que responda en cualquier mensaje como, por ejemplo, tomo "boomer" como mi mensaje, pero el bot no responde en absoluto.

 const Discord = require("discord.js"); const { Client } = require('discord.js'); const client = new Discord.Client({ intents: [ 32509 ] }) client.on("ready", () => { console.log(`Logged in as ${client.user.tag}!`); client.user.setActivity('Running a test, hopefully.'); }) client.on("messageCreate", (message) => { if (message.content.toLowerCase().includes("boomer")) { message.channel.send("how are you there!"); } if (message.author.bot) return false; if (message.content.includes("@here") || message.content.includes("@everyone") || message.type == "REPLY") return false; if (message.mentions.has(client.user.id)) { message.channel.send("Hello there!"); } }); client.login(process.env.TOKEN)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Con su intent actual 32509 se habilitan los siguientes:

  • GUILDS (1 << 0)
  • GUILD_BANS (1 << 2)
  • GUILD_EMOJIS_AND_STICKERS (1 << 3)
  • GUILD_INTEGRATIONS (1 << 4)
  • GUILD_WEBHOOKS (1 << 5)
  • GUILD_INVITES (1 << 6)
  • GUILD_VOICE_STATES (1 << 7)
  • GUILD_MESSAGES (1 << 9)
  • GUILD_MESSAGE_REACTIONS (1 << 10)
  • GUILD_MESSAGE_TYPING (1 << 11)
  • DIRECT_MESSAGES (1 << 12)
  • DIRECT_MESSAGE_REACTIONS (1 << 13)
  • DIRECT_MESSAGE_TYPING (1 << 14)

El problema es que agregaste muchos innecesarios pero te falta la intención de MESSAGE_CONTENT . Significa que message.content no tiene ningún valor , pero message.mentions sí. Es por eso que funciona cuando mencionas el bot y no funciona cuando verificas si el contenido del message.content incluye la cadena "boomer" .

Para resolver esto, puede agregar 32768 ( 1 << 15 ) al número actual:

 const client = new Client({ intents: [65277], });

o incluso mejor, solo usa los que realmente necesitas:

 const { Client, GatewayIntentBits } = require('discord.js'); const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ], });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!