firebolthappy
firebolthappy

Reputation: 15

How to make discord.js bot repeat message given to it in another channel?

I'm using discord.js and am trying to make a bot so that everytime this specific person says something from another server that the bot is in, I want the bot to repeat this message in a specific channel.

client.on('message', message => {
  if (message.author === ("244921929495085057")){
    client.channels.get("655598459268759593").send(message.content);
  }
})

I can't figure out how to do this. Thank you!

Upvotes: 0

Views: 786

Answers (1)

Syntle
Syntle

Reputation: 5174

I'm assuming you are using the latest version of discord.js which is v12 at the time of writing this.

According to the discord.js docs

You need to add .cache after client.channels to access the channels list.

Upvotes: 1

Related Questions