Get Message By ID: Discord.js
fetchMessage
is no longer present in Discord.js starting in version 12, but you can use the fetch
method of the MessageManager
class from the messages
property of the TextChannel
class.
msg.channel.messages.fetch("701574160211771462")
.then(message => console.log(message.content))
.catch(console.error);
You can retrieve a message by id through
msg.channel.fetchMessage();
The documentation is here. If you want to be able to retrieve a message from any channel by id, you can loop through all channels and catch any errors.