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

147
Views
Discord.js envía un mensaje en un canal específico usando un controlador de comandos por cierto

Estoy tratando de hacer el código en este video donde envía mensajes a diferentes canales, pero cuando hago destination.send(“message”) , dice que el destination is not defined cuando lo defino en la línea anterior let destination = client.channels.fetch('11223344556677');

mi código es:

 const Discord = require("discord.js"); const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS"], partials: ["MESSAGE"] }); module.exports = { name: "stop", description: "this stops the server!", execute(message, args) { if (message.member.roles.cache.has("112233445566778899")) { let destination = client.channels.fetch("112233445566778899"); if (destination) { destination.send("stop"); } } }, //else { //message.channel.send("I see you don't have the correct permissions"); }; //} client.login("112233445566778899");

lo que estoy tratando de hacer es tener un comando !stop donde envía stop a un canal con la identificación del canal.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo quechannels.fetch no funciona en su versión discord.js. Prueba mi código a continuación:

 const Discord = require("discord.js"); const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS"], partials: ["MESSAGE"] }); module.exports = { name: "stop", description: "this stops the server!", execute(message, args) { if (message.member.roles.cache.has("role_id")) { let destination = client.channels.cache.get("channel_id"); if (destination) { destination.send("stop"); } } }, }; client.login("bot_token");
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!