My telegram bot is an admin in a channel.
I’m listening to message using on_message handler.
I want to get the username/userid of the user of that message. How can I do that in pyrogram or another python telegram bot library?
My telegram bot is an admin in a channel.
I’m listening to message using on_message handler.
I want to get the username/userid of the user of that message. How can I do that in pyrogram or another python telegram bot library?
2
Answers
Telegram doesn’t expose the username or their ID for messages in a channel. Not even to other admins.
The only indication you get is
Message.author_signature
as a string, which contains the "Signature of the post author for messages in channels, or the custom title of an anonymous group administrator."See https://docs.pyrogram.org/api/types/Message
Using the
update.message.from_user
from this python library , you can get pretty much all the user info