Discord.js: message.channel_id returns undefined always

Created on 23 Sep 2018  ·  4Comments  ·  Source: discordjs/discord.js


client.on("message", async message => {
  if(message.author.bot) return;

  var d = new Date();
  var time = d.toLocaleString();
  console.log("[" + time + "] " + message.channel_id + " -> " + message.author.username + " #" + message.author.id + " : " + message.content);
});

Further details:

  • discord.js version: 11.4.2
  • Node.js version: 8.12.0 LTS
  • Operating system: Windows 10 Pro 1803 17134.285
  • Priority this issue should have – please be realistic and elaborate if possible: Low priority.
  • [x] I found this issue while running code on a __user account__
  • [ ] I have also tested the issue on latest master, commit hash:
question (please use Discord instead)

All 4 comments

Unsure where you got the idea that it is message.channel_id
It should be message.channel.id

image
From here

https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=channel

Please refer to our documentation, not Discords if you use our library.

(人''▽`)ありがとう☆
米の際

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iCrawl picture iCrawl  ·  3Comments

Dmitry221060 picture Dmitry221060  ·  3Comments

kvn1351 picture kvn1351  ·  3Comments

tiritto picture tiritto  ·  3Comments

Lombra picture Lombra  ·  3Comments