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

252
Views
Cómo enviar un mensaje en un canal específico con id

Usé la base de datos de repetición para guardar la identificación del canal
Este es mi código:
client.channels.cache.get(db.get(args[1])).send(args[2]);
y me sale este error:

 client.channels.cache.get(db.get(args[1])).send(args[2]); ^ TypeError: Cannot read properties of undefined (reading 'send') at Client.<anonymous> (/home/runner/anonymesssendbot/index.js:44:49) at Client.emit (node:events:390:28) at Client.emit (node:domain:475:12) at MessageCreateAction.handle (/home/runner/anonymesssendbot/node_modules/discord.js/src/client/actions/MessageCreate.js:34:18) at Object.module.exports [as MESSAGE_CREATE] (/home/runner/anonymesssendbot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (/home/runner/anonymesssendbot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:346:31) at WebSocketShard.onPacket (/home/runner/anonymesssendbot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:478:22) at WebSocketShard.onMessage (/home/runner/anonymesssendbot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:317:10) at WebSocket.onMessage (/home/runner/anonymesssendbot/node_modules/ws/lib/event-target.js:199:18) repl process died unexpectedly: exit status 1
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Supongo que db.get() devuelve una promesa que no puede pasar como valor. Intente recuperar el valor primero y luego obtenga el canal. Algo como

 const id = await db.get(args[1]); const channel = client.channels.cache.get(id); channel.send(args[2]);

También existe la posibilidad de que la identificación se almacene incorrectamente en su servidor. Así que echa un vistazo a eso. Puede registrar la identificación para verificar si ese es el caso.

about 4 years ago · Santiago Gelvez 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!