Forgive me if the feature already exists and I just didn't look hard enough, but I'm pretty sure that it doesn't exist yet.
The feature should probably be somewhere inside the Chat structure, similar to how Client has a .getChatById method.
Chat.getMessageById(messageID);
This would be useful for replying to or quoting any given message.
You can access the properties and methods of the messages here. https://pedroslopez.me/whatsapp-web.js/Message.html
You can access the id of each message here:
client.on ('message', async msg => {
console.log (msg.id);
/*
{
fromMe: false,
remote: '[email protected]',
id: '17ADF6142476636C9AY9F62BA24D05E9',
_serialized: '[email protected]_72ADF6632476636C3DA9F62BAC9D05E9'
}
*/
});
You can store the incoming message objects and then return to the replies over those message objects.
msg.reply("content",msg.from);
Likewise, you can access chat features and methods from here.
https://pedroslopez.me/whatsapp-web.js/Chat.html
I think the best approach is improve the fetchMessages()
const chat = await client.getChatById("[email protected]");
const message = await chat.fetchMessages({ where: { ... } });
Most helpful comment
I think the best approach is improve the
fetchMessages()