Last active
April 24, 2024 07:11
-
-
Save phpRajat/a6422922efae32914f4dbd1082f3f412 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function() { | |
function getAllModules() { | |
return new Promise((resolve) => { | |
const id = _.uniqueId("fakeModule_"); | |
window["webpackJsonp"]( | |
[], | |
{ | |
[id]: function(module, exports, __webpack_require__) { | |
resolve(__webpack_require__.c); | |
} | |
}, | |
[id] | |
); | |
}); | |
} | |
var modules = getAllModules()._value; | |
for (var key in modules) { | |
if (modules[key].exports) { | |
if (modules[key].exports.createFromData) { | |
createFromData_id = modules[key].i.replace(/"/g, '"'); | |
} | |
if (modules[key].exports.prepRawMedia) { | |
prepareRawMedia_id = modules[key].i.replace(/"/g, '"'); | |
} | |
if (modules[key].exports.default) { | |
if (modules[key].exports.default.Wap) { | |
store_id = modules[key].i.replace(/"/g, '"'); | |
} | |
} | |
if (modules[key].exports.sendTextMsgToChat) { | |
chat_id = modules[key].i.replace(/"/g, '"'); | |
} | |
} | |
} | |
}, 2000); | |
function _requireById(id) { | |
return webpackJsonp([], null, [id]); | |
} | |
var createFromData_id = 0; | |
var prepareRawMedia_id = 0; | |
var store_id = 0; | |
var chat_id = 0; | |
function fixBinary (bin) { | |
var length = bin.length; | |
var buf = new ArrayBuffer(length); | |
var arr = new Uint8Array(buf); | |
for (var i = 0; i < length; i++) { | |
arr[i] = bin.charCodeAt(i); | |
} | |
return buf; | |
} | |
var send_media; | |
window.send_media = function(jid, link, caption, msg_id, content_type) { | |
var file = ""; | |
var createFromDataClass = _requireById(createFromData_id)["default"]; | |
var prepareRawMediaClass = _requireById(prepareRawMedia_id).prepRawMedia; | |
window.Store.Chat.find(jid).then((chat) => { | |
var img_b64 = link; | |
var base64 = img_b64.split(',')[1]; | |
var type = img_b64.split(',')[0]; | |
type = type.split(';')[0]; | |
type = type.split(':')[1]; | |
var binary = fixBinary(atob(base64)); | |
var blob = new Blob([binary], {type: type}); | |
var random_name = Math.random().toString(36).substr(2, 5); | |
file = new File([blob], random_name, { | |
type: type, | |
lastModified: Date.now() | |
}); | |
var temp = createFromDataClass.createFromData(file, file.type); | |
var rawMedia = prepareRawMediaClass(temp, {}); | |
var target = _.filter(window.Store.Msg.models, (msg) => { | |
return msg.id.id === msg_id; | |
})[0]; | |
var textPortion = { | |
caption: caption, | |
mentionedJidList: [], | |
quotedMsg: target | |
}; | |
rawMedia.sendToChat(chat, textPortion); | |
}); | |
} | |
var Store = {}; | |
function init() { | |
window.Store = _requireById(store_id).default; | |
window.Store.sendTextMsgToChat = _requireById(chat_id).sendTextMsgToChat; | |
console.log("Store is ready"); | |
console.log(window.Store); | |
window.send_media("[email protected]", "data:image/png;base64,iVBORw0KG..........sda=", "test messsage", null, null); | |
} | |
setTimeout(function() { | |
init(); | |
}, 5000); |
sir is their any way to check valid/invalid whatsapp number,please help?
Finally this solution worked. mikelustosa/Projeto-TInject#41
sir its not working after latest whatsapp update,is their any other way to check valid/invalid whatsapp numbers? plz help
This WAPI make some problems on reply messages, anyone find solutions?
@ADISOMMA , you can use WPPConnect/WA-JS, look for quoteMessage while send a message
sir is their any way to check valid/invalid whatsapp number,please help?
Yes. Use TInject's NewCheckIsValidNumber(number) function.
isLoggedIn not working
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Desculpe pela demora! Feito. Parabéns pelo belo trabalho em JS!