A
A
Adrian Makridenko2020-09-20 11:05:41
Node.js
Adrian Makridenko, 2020-09-20 11:05:41

Discord bot reading private messages from user JS?

Hello. How can I make the bot read messages only from a specific user (let's say by ID), save his message and output them to a specific channel?
Mandatory in JS

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-09-20
@maccree

if (message.channel.type === 'dm') { // если тип канала - DM (личные сообщения) . . .
  if (message.author.id === "ID_пользователя") { // если ID пользователя === . . .
    client.channels.cache.get('ID_канала').send(`${message.content}`); // находим канал по его ID и отправляем туда контент сообщения.
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question