mtproto-core icon indicating copy to clipboard operation
mtproto-core copied to clipboard

Cannot read property 'call' of undefined

Open Marco-Gtto opened this issue 3 years ago • 1 comments

I'm trying to get an user:

user_id = parseInt(warnList[0]["staffer"]) 
console.log("ID:", user_id)

staffer = await api.call('users.getFullUser', {id: user_id});
console.log(staffer)

Below what is printed by console.log("ID:", user_id): ID: 935648014

I'm getting this error: users.getFullUser error: TypeError: Cannot read property 'call' of undefined

Maybe this issue is caused due to a bad parameter. However i have no idea about the right parameter to use. Help would be appreciated

Marco-Gtto avatar Aug 30 '21 22:08 Marco-Gtto

Param id's type need to be InputUser, not int https://core.telegram.org/method/users.getFullUser https://core.telegram.org/type/InputUser https://core.telegram.org/constructor/inputUser

e.g. inputUserSelf

const user_info = await api.call('users.getFullUser', {
    id: {
        _: 'inputUserSelf'
    }
})
console.log(user_info);

inputUser

const user_info = await api.call('users.getFullUser', {
    id: {
        _: 'inputUser',
        user_id: 94032407,
        access_hash: 'access_hash value from the User constructor',
    }
})
console.log(user_info);

exilibriss avatar Sep 13 '21 04:09 exilibriss