open-wa / wa-automate-python

💬 🤖 The most advanced Python whatsapp library for chatbots with advanced features. Be sure to ⭐ this repository for updates!
Other
342 stars 74 forks source link

send_message_with_auto_preview() return always False value #40

Closed manojsitapara closed 4 years ago

manojsitapara commented 4 years ago

Following method always return False even it send message to the participant

send_message_with_auto_preview(chat_id=chat_id, url=url, text=text)

Note: send_message() method return True and False correctly.

chat_send_message(chat_id=chat_id, message=text)

Earlier send_message_with_auto_preview() was working fine but after update wa-automate-python it give this issue

Can you please help me?

mrodal commented 4 years ago

Its being fixed, it should be ready for tonight

manojsitapara commented 4 years ago

@mrodal is new build ready?

mrodal commented 4 years ago

sorry, not yet, we are waiting for a fix on the parent nodejs repo

mrodal commented 4 years ago

if you need it fixed now, you can copy this

window.WAPI.sendLinkWithAutoPreview = async function (chatId, url, text) {
    text = text || '';
    var chatSend = WAPI.getChat(chatId);
    if (chatSend === undefined) {
        return false;
    }
    const linkPreview = await Store.WapQuery.queryLinkPreview(url);
    return (await chatSend.sendMessage(text.includes(url) ? text : `${url}\n${text}`, {linkPreview}))=='OK'
}

at the end of src/js/pywapi.js

manojsitapara commented 4 years ago

No problem, I will wait till new build ready. By the way above fix is working.

manojsitapara commented 4 years ago

@mrodal is new build ready with this fix?

marcelocecin commented 4 years ago

nop

mrodal commented 4 years ago

Done, could you try now? You shouldnt need to update the version or anything

manojsitapara commented 4 years ago

It's working. Thank you !!