td icon indicating copy to clipboard operation
td copied to clipboard

how to get the sender's information from MessagesChannelMessages?

Open scp-66 opened this issue 3 years ago • 3 comments

Discussed in https://github.com/gotd/td/discussions/1116

Originally posted by scp-66 June 8, 2023 Hello, thank you very much for your development, this library has greatly facilitated my work. I apologize that I am still a beginner with the Telegram API. When I use this library to get the message history of a channel, I can only find their FromID.UserID. I have tried for a long time, but I couldn't find a graceful way to associate this UserID with the sender's information, such as their username, and display it. Can you teach me how?

scp-66 avatar Jun 08 '23 08:06 scp-66

I have already solved it.

scp-66 avatar Jun 14 '23 06:06 scp-66

I have already solved it.

How to do it

sky7987 avatar Jun 14 '23 06:06 sky7987

I found that the Messages structure contains a Users member. We only need to create a usermap for them in advance, and then use this map to obtain the corresponding member information after getting the PeerUser.UserID of the corresponding message. I tested that this Map contains all the necessary member information, and nothing will be missed. image

scp-66 avatar Jun 14 '23 06:06 scp-66