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

195
Views
console.log script returns "Wrong channel!"

I'm setting up a Discord bot, and I want it to send a message to the main channel of my server when I type node .. I typed:

client.on('ready', () => {
  const Channel = client.channels.cache.get('<My.General.Channel.ID#>');
  if (!Channel) return console.log('Wrong channel!');
  else Channel.send('I am here');
});

I get "Wrong channel!". I should just insert the channel ID number, right? I've directly pasted from Discord's "Copy ID" and still get a problem.

Edit:

I updated my intents and my code. It now shows:

client.on('ready', message => {
  client.channels.cache.get('channel-id').send('message.')

This resolved my issues.

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

0

if you're using v12 this must be work for your error.

client.on("message", function(message) {
  const Channel = message.channel.id == <My.General.Channel.ID#>;
  if (!Channel) return console.log('Wrong channel!');
  else message.channel.send('I am here');
});
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!