gramjs
gramjs copied to clipboard
Api.users.GetFullUser doesn't work at 100%.. with userId in Input
Hi guys,
I don't understand something. I'm trying since few hours to get the "GetFullUser" from Telegram usersId.
I tried with Telegram users 6 accounts
With 2, it works, with 4 I got this error : Error: Could not find the input entity for {"userId":"1163888275","className":"PeerUser"}. Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.
With theses 2 users id It works :
const getFullUser = await client.invoke(
new Api.users.GetFullUser({
id: "1935787208",
})
);
const getFullUser = await client.invoke(
new Api.users.GetFullUser({
id: "734365423",
})
);
With theses 4 users id it didn't works...
const getFullUser = await client.invoke(
new Api.users.GetFullUser({
id: "5522131067",
})
);
const getFullUser = await client.invoke(
new Api.users.GetFullUser({
id: "748364768",
})
);
const getFullUser = await client.invoke(
new Api.users.GetFullUser({
id: "1061927702",
})
);
const getFullUser = await client.invoke(
new Api.users.GetFullUser({
id: "1163888275",
})
);
I got all users id doing the same call with the username in Input, so usersId are good
It's so weird... Do you know why?
Thanks a lot
Hi @painor, do you have ideas? Thanks a lot
You can't use the IDs alone. You also need the accessHash.
The accessHash is different for each account. If the library has seen that ID before it stores the accesshash locally so that you don't need to type it yourself. if the library has never seen that ID before it won't know what the accessHash and will throw that error.
So in short the reason it worked is because with the 2 accounts the library has seen those users before but it didn't with the others.
You can't use the IDs alone. You also need the accessHash.
The accessHash is different for each account. If the library has seen that ID before it stores the accesshash locally so that you don't need to type it yourself. if the library has never seen that ID before it won't know what the accessHash and will throw that error.
So in short the reason it worked is because with the 2 accounts the library has seen those users before but it didn't with the others.
I'm also encountering a similar issue: GetUsers returns empty array even though I'm using the same userId as the one I got from "fromId" field of a message provided by the "UpdateNewChannelMessage" event. Furthermore I'm providing an accessHash that I received with Api.channels.GetChannels() call while processing the new message update.
Have you encountered that before?