ℹī¸Tips

Introducing, lastMessage.

Last Message is a group of methods that you can use, they've been built to boost your productivity, and are helping you to do simple actions without storing the last message, in other words, without writing 10 lines of codes for such simple things.

editLast & deleteLast

Allows you to edit/delete the last message sent with the message component itself:

client.on('messageCreate', async (message) => {
   const member = await message.member;
   if (member.app) return;
   await message.createMessage({content: "this is a message"}); // this is msg1
   await message.editLast({content: "msg1 is edited."});
   await message.createFollowup({content: "this is a message"}); // this is msg2
   await message.editLast({content: "msg2 is edited."});
   // The last message you sent is edited, allowing you to use the
   // the same message component instead of using a stored one.
   
   // this deletes msg2, which is in fact, the last message.
   await message.deleteLast();
})

Original Messages

Learn more: Check out how this concept works to optimize your time interacting with parent messages/responses.

Last updated