TelegramApi
TelegramApi copied to clipboard
Get user real name and last name
Exists a method for this in the official documentation, https://core.telegram.org/method/users.getFullUser.
In ruben implementation, the TLMethod is TLRequestUsersGetFullUser passing the userId. But, when I do the RPC call, is returned the object FullUser, but the parameters in the Telegram docs:
real_first_name:string real_last_name:string
Don't come with the request response. The code I used the do this:
public void getFullUser(IUser user) {
LOG.info("RPC to get full user to user [{}]", ToStringBuilder.reflectionToString(user));
try {
TLRequestUsersGetFullUser getFullUser = new TLRequestUsersGetFullUser();
getFullUser.setId(TLFactory.createTLInputUser(user));
TLUserFull userFull = kernelComm.doRpcCallSync(getFullUser);
if (userFull.getUser() instanceof TLUser) {
LOG.info("USER_FULL: [{}]", ToStringBuilder.reflectionToString(userFull));
LOG.info("USER: [{}]", ToStringBuilder.reflectionToString(userFull.getUser()));
}
} catch (Exception ex) {
LOG.error("Exception getting user info", ex);
}
}
The LOG returns this:
USER_FULL: [org.telegram.api.user.TLUserFull@1e813ff1[flags=16,user=user.TLUser#2e13f4c3,about=<null>,link=contacts.link#3ace484c,profilePhoto=<null>,notifySettings=peerNotifySettings#9acda4c0,botInfo=<null>,commonChatsCount=0]]
USER: [org.telegram.api.user.TLUser@5b6deaf4[flags=6231,accessHash=-8678087293724309622,firstName=Neppo,lastName=322,userName=,phone=5534999837403,photo=<null>,status=userStatusOnline#edb93949,botInfoVersion=0,restrictionReason=<null>,botInlinePlaceholder=<null>,langCode=<null>,id=637946833]]
There is another way to get this info? Or change the ruben API and make a pr?