Repository: pedroslopez/whatsapp-web.js
File: src/util/Injected.js (JavaScript)

Code before:
    window.Store.GroupUtils = {
        ...window.mR.findModule('sendCreateGroup')[0],
        ...window.mR.findModule('sendSetGroupSubject')[0]
    };

    if (!window.Store.Chat._find) {
        window.Store.Chat._find = e => {
            const target = window.Store.Chat.get(e);
            return target ? Promise.resolve(target) : Promise.resolve({
                id: e
            });
        };
    }
};

exports.LoadUtils = () => {
    window.WWebJS = {};

    window.WWebJS.getNumberId = async (id) => {

        if (window.Store.Features.features.MD_BACKEND) {
            id = window.Store.WidFactory.createWid(id);
            let handler = (new window.Store.USyncQuery).withContactProtocol();
            handler = handler.withUser((new window.Store.USyncUser).withId(id), handler.withDeviceProtocol(), 1);
            let result = await handler.execute();
            if (result.list[0].devices.deviceList.length>0) {
                return id;
            }
            throw 'The number provided is not a registered whatsapp user';
        } else {
            let result = await window.Store.Wap.queryExist(id);
            if (result.jid === undefined)
                throw 'The number provided is not a registered whatsapp user';
            return result.jid;
        }
    };

    window.WWebJS.sendSeen = async (chatId) => {
        let chat = window.Store.Chat.get(chatId);
        if (chat !== undefined) {
            await window.Store.SendSeen.sendSeen(chat, false);
            return true;
        }
        return false;

    };

    window.WWebJS.sendMessage = async (chat, content, options = {}) => {
        let attOptions = {};
        if (options.attachment) {
            attOptions = options.sendMediaAsSticker

Review comment (suggestion):
```suggestion
            if (result.list[0].devices.deviceList.length > 0) {
```

Code after:
    window.Store.GroupUtils = {
        ...window.mR.findModule('sendCreateGroup')[0],
        ...window.mR.findModule('sendSetGroupSubject')[0]
    };

    if (!window.Store.Chat._find) {
        window.Store.Chat._find = e => {
            const target = window.Store.Chat.get(e);
            return target ? Promise.resolve(target) : Promise.resolve({
                id: e
            });
        };
    }
};

exports.LoadUtils = () => {
    window.WWebJS = {};

    window.WWebJS.getNumberId = async (id) => {

        if (window.Store.Features.features.MD_BACKEND) {
            id = window.Store.WidFactory.createWid(id);
            let handler = (new window.Store.USyncQuery).withContactProtocol();
            handler = handler.withUser((new window.Store.USyncUser).withId(id), handler.withDeviceProtocol(), 1);
            let result = await handler.execute();
            if (result.list[0].devices.deviceList.length > 0) {
                return id;
            }
            throw 'The number provided is not a registered whatsapp user';
        } else {
            let result = await window.Store.Wap.queryExist(id);
            if (result.jid === undefined)
                throw 'The number provided is not a registered whatsapp user';
            return result.jid;
        }
    };

    window.WWebJS.sendSeen = async (chatId) => {
        let chat = window.Store.Chat.get(chatId);
        if (chat !== undefined) {
            await window.Store.SendSeen.sendSeen(chat, false);
            return true;
        }
        return false;

    };

    window.WWebJS.sendMessage = async (chat, content, options = {}) => {
        let attOptions = {};
        if (options.attachment) {
            attOptions = options.sendMediaAsSticker