1// Fetching a message by ID (Discord.js versions 9 through 11)
2// note: you can line return right before a "dot" in JS, that is valid.
3message.channel.fetchMessages({around: "352292052538753025", limit: 1})
4 .then(messages => {
5 const fetchedMsg = messages.first(); // messages is a collection!)
6 // do something with it
7 fetchedMsg.edit("This fetched message was edited");
8 });
9
10// THIS CHANGES IN DISCORD VERSION 12!!!!!
11message.channel.messages.fetch({around: "352292052538753025", limit: 1})
12 .then(messages => {
13 messages.first().edit("This fetched message was edited");
14 });
1// Editing a message the bot sent
2message.channel.send("Test").then(sentMessage => sentMessage.edit("Blah"));
3// message now reads : "Blah"