Webwhatsapp-wrapper: Store.Chat.find('[email protected]') error ModelCreateError

Created on 25 Aug 2018  路  10Comments  路  Source: mukulhase/WebWhatsapp-Wrapper

Most helpful comment

var id = new window.Store.UserConstructor(idToFind);
Store.Chat.find(id)

All 10 comments

Did you find the solution ?

No. Before I ran this function and even if the number was not my contact, it would create the chat and be able to perform the functions. Now return this error!

var id = new window.Store.UserConstructor(idToFind);
Store.Chat.find(id)

@bobaoapae
couldn't find any UserConstructor function? :/

Hello @bobaoopae, when running var id = new window.Store.UserConstructor ("[email protected]"); I get this error window.Store.UserConstructor is not a constructor

I found it, thank you! { id: "UserConstructor", conditions: (module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null }

wallysonn, como voc锚 conseguiu criar um novo UserConstructor? Ainda n茫o consegui achar.

const chatId = new Store.UserConstructor("[email protected]");
            let chat = await Store.Chat.find(chatId).then((r) => {
                return r;
            });
chat.sendMessage("message here");

use:

(function () {
                    function getStore(modules) {
                        let foundCount = 0;
                        let neededObjects = [
                            {id: "Store", conditions: (module) => (module.Chat && module.Msg) ? module : null},
                            {id: "Wap", conditions: (module) => (module.createGroup) ? module : null},
                            {
                                id: "MediaCollection",
                                conditions: (module) => (module.default && module.default.prototype && module.default.prototype.processFiles !== undefined) ? module.default : null
                            },
                            {
                                id: "WapDelete",
                                conditions: (module) => (module.sendConversationDelete && module.sendConversationDelete.length == 2) ? module : null
                            },
                            {
                                id: "Conn",
                                conditions: (module) => (module.default && module.default.ref && module.default.refTTL) ? module.default : null
                            },
                            {id: "WapQuery", conditions: (module) => (module.queryExist) ? module : null},
                            {
                                id: "ProtoConstructor",
                                conditions: (module) => (module.prototype && module.prototype.constructor.toString().indexOf('binaryProtocol deprecated version') >= 0) ? module : null
                            },
                            {
                                id: "UserConstructor",
                                conditions: (module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null
                            }
                        ];
                        for (let idx in modules) {
                            if ((typeof modules[idx] === "object") && (modules[idx] !== null)) {
                                let first = Object.values(modules[idx])[0];
                                if ((typeof first === "object") && (first.exports)) {
                                    for (let idx2 in modules[idx]) {
                                        let module = modules(idx2);
                                        if (!module) {
                                            continue;
                                        }

                                        neededObjects.forEach((needObj) => {
                                            if (!needObj.conditions || needObj.foundedModule) return;
                                            let neededModule = needObj.conditions(module);
                                            if (neededModule !== null) {
                                                foundCount++;
                                                needObj.foundedModule = neededModule;
                                            }
                                        });

                                        if (foundCount === neededObjects.length) {
                                            break;
                                        }
                                    }

                                    let neededStore = neededObjects.find((needObj) => needObj.id === "Store");
                                    window.Store = neededStore.foundedModule ? neededStore.foundedModule : {};
                                    neededObjects.splice(neededObjects.indexOf(neededStore), 1);
                                    neededObjects.forEach((needObj) => {
                                        if (needObj.foundedModule) {
                                            window.Store[needObj.id] = needObj.foundedModule;
                                        }
                                    });

                                    return window.Store;
                                }
                            }
                        }
                    }

                    webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, 'parasite');
                })();

Muito obrigado galera! Precisava disso

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EdisonHundLucas picture EdisonHundLucas  路  6Comments

d2hf picture d2hf  路  6Comments

kashif-raza picture kashif-raza  路  5Comments

Zingers-ZA picture Zingers-ZA  路  6Comments

smileman03 picture smileman03  路  5Comments