Skip to content

Instantly share code, notes, and snippets.

@fhferreira
Forked from phpRajat/whatsapp2.js
Created January 21, 2020 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fhferreira/f01404f940ba6d85ac1736a02dbfcded to your computer and use it in GitHub Desktop.
Save fhferreira/f01404f940ba6d85ac1736a02dbfcded 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.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 store_id = 0;
var chat_id = 0;
var Store = {};
function init() {
window.Store = _requireById(store_id).default;
window.Store.sendTextMsgToChat = _requireById(chat_id).sendTextMsgToChat;
console.log("Store is ready");
window.Store.Chat.find("91xxxxxxxxxx@c.us").then((user) => { window.Store.sendTextMsgToChat(user, "hellao"); });
}
setTimeout(function () {
init();
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment