Open GgAaYyAaNn opened 4 years ago
Return False for me too, but the message is sending with success.
this worked for me, if I send the message it returns True and if I don't send it a False
window.WAPI.sendMessageToID = function (id, message, done) {
try {
window.getContact = (id) => {
return Store.WapQuery.queryExist(id);
}
window.getContact(id).then(contact => {
console.log('0')
if (contact.status === 404) {
console.log('0.1')
return done ? done(true) : true
} else {
Store.Chat.find(contact.jid).then(chat => {
console.log('1')
chat.sendMessage(message);
return done ? done(true) : true
}).catch(reject => {
try {
if (WAPI.sendMessage(id, message)) {
return done ? done(true) : true
}else{
return done ? done(true) : true
}
} catch (error) {
return done ? done(false) : false
}
});
}
});
} catch (e) {
console.log('fue 2')
if (window.Store.Chat.length === 0)
return done ? done(false) : false
firstChat = Store.Chat.models[0];
var originalID = firstChat.id;
firstChat.id = typeof originalID === "string" ? id : new window.Store.UserConstructor(id, { intentionallyUsePrivateConstructor: true });
if( ! firstChat.sendMessage ){
return done ? done(false) : false
}else if (done !== undefined) {
firstChat.sendMessage(message).then(function () {
firstChat.id = originalID;
done(true);
});
return true;
} else {
firstChat.sendMessage(message);
firstChat.id = originalID;
return true;
}
}
}
@andrew-shamin Advertising of monetized Frameworks is strictly forbidden and will be reported
send_message_to_id is always return False