gramjs icon indicating copy to clipboard operation
gramjs copied to clipboard

FullUser does not return birthday and personalChannelId

Open IlyaBarkov opened this issue 1 year ago • 1 comments

Hello! I am using the most up to date version of webpack-build of GramJS. I want to get information about new fields birthday and personalChannelId for the account, where they are listed. For this purpuse I use the code:

        const userResult = await client.invoke(
            new Api.users.GetFullUser({
                id: "@Dolce_Dasha"
            })
        );
        console.log(userResult.fullUser);

But fullUser doest not have a field for birthday, neither a field for personalChannelId. However judging from the code tl\api.d.ts - they have to be there.

Please, tell me if these data does not come from Telegram API? Or they come from Telegram API, but the GramJS does not display it?

Thanks for your help in advance!

Ilya

tg-fulluser

tg-viewprofile

IlyaBarkov avatar Aug 25 '24 15:08 IlyaBarkov

Hello! I am using the most up to date version of webpack-build of GramJS. I want to get information about new fields birthday and personalChannelId for the account, where they are listed. For this purpuse I use the code:

        const userResult = await client.invoke(
            new Api.users.GetFullUser({
                id: "@Dolce_Dasha"
            })
        );
        console.log(userResult.fullUser);

But fullUser doest not have a field for birthday, neither a field for personalChannelId. However judging from the code tl\api.d.ts - they have to be there.

Please, tell me if these data does not come from Telegram API? Or they come from Telegram API, but the GramJS does not display it?

Thanks for your help in advance!

Ilya

tg-fulluser

tg-viewprofile

// Get user entity by username
const userEntity = await client.getEntity(user);

// Type checking guard
if (userEntity.className === "User") {
  // Get full user details
  const userDetails = await client.invoke(
    new Api.users.GetFullUser({
      // Requires a user entity as ID
      id: userEntity,
    }),
  );
  
  // Type checking guard
  if (userDetails.className === "users.UserFull") {
    // Optional: log full details to console
    // console.log(userDetails);
    
    // If user's personal channel exists, log it to console
    console.log("Personal-Channel:", userDetails.fullUser.personalChannelId);
    
    // If user's birthday exists and is accessible, log it to console
    console.log("Birthday:", userDetails.fullUser.birthday);
  }
}

Image

More Details :)

Vanillma avatar May 19 '25 04:05 Vanillma