-
-
Save phpRajat/a6422922efae32914f4dbd1082f3f412 to your computer and use it in GitHub Desktop.
| 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); |
For now it is only possible to view the buttons on whatsapp web. We are still trying to find a solution.
@mikelustosa se você olhar bem o nosso projeto do WPP4Delphi, temos todas as referências com o seu nome, que teve origem no TInject, alias, o Marcelo fez um grande trabalho de colocar em todo lugar que estava faltando.
Eu peço por gentileza que você faça o mesmo relacionado a parte de javascript.
Eu criei o projeto WA-JS do zero, fazendo abstrações e criando funções novas, na qual o objetivo desse projeto é ser um javascript que pode ser usado por qualquer projeto (inclusive você pode usar no TInject).
Única coisa que peço é fazer a referência correta do projeto, como exemplo o commit abaixo e a origem do código:
Origem do código:
https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareRawMessage.ts
https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/sendRawMessage.ts
https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/sendCreatePollMessage.ts
Desculpe pela demora! Feito. Parabéns pelo belo trabalho em JS!
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
@mikelustosa se você olhar bem o nosso projeto do WPP4Delphi, temos todas as referências com o seu nome, que teve origem no TInject, alias, o Marcelo fez um grande trabalho de colocar em todo lugar que estava faltando.
Eu peço por gentileza que você faça o mesmo relacionado a parte de javascript.
Eu criei o projeto WA-JS do zero, fazendo abstrações e criando funções novas, na qual o objetivo desse projeto é ser um javascript que pode ser usado por qualquer projeto (inclusive você pode usar no TInject).
Única coisa que peço é fazer a referência correta do projeto, como exemplo o commit abaixo e a origem do código:
mikelustosa/Projeto-TInject@16e5077#diff-e1f4c52f75b4c739ee87b883b2cb0152a899308d6af98c40dac6b476c415c01e
Origem do código:
https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareRawMessage.ts
https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/sendRawMessage.ts
https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/sendCreatePollMessage.ts