lib/context.js
function createProxy(api, obj, methods) {
    return new Proxy(obj, {
        get(target, name) {
            if (methods.includes(name)) {
                return (params, callback) => {
                    const inject = Object.assign({ chat_id: obj.id }, params);
                    return api.method(name, inject, callback);
                };
            }

            return target[name];
        },

        set() {
            return new Error('Cannot change `chat` or `user`.');
        },
    });
}
function createProxy(api, obj, methods) {
    return new Proxy(obj, {
        get(target, name) {
            if (methods.includes(name)) {
                return (params, callback) => {
                    const inject = Object.assign({ chat_id: obj.id }, params);
                    return api.method(name, inject, callback);
                };
            }

            return target[name];
        },

        set() {
            return new Error('Cannot change `chat` or `user`.');
        },
    });
}
Methods
@private