skip to Main Content

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


  1. 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

    Login or Signup to reply.
  2. Using the update.message.from_user from this python library , you can get pretty much all the user info

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search