Documentation - v0.27.1
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    raw: RawUser

    Underlying raw TL object

    type: "user" = ...

    Accessors

    • get dcId(): number | null

      User's or bot's assigned DC (data center). Available only in case the user has set a public profile photo.

      Note: this information is approximate; it is based on where Telegram stores a user profile pictures and does not by any means tell you the user location (i.e. a user might travel far away, but will still connect to its assigned DC). More info at Pyrogram FAQ.

      Returns number | null

    Methods

    • Create a mention for the user.

      When available and text is omitted, this method will return @username. Otherwise, text mention is created.

      Use null as text (first parameter) to force create a text mention with display name, even if there is a username.

      Note: This method doesn't format anything on its own. Instead, it returns a MessageEntity that can later be used with html or md template tags

      Parameters

      • Optionaltext: string | null

        Text of the mention.

      Returns string | MessageEntity

      msg.replyText(html`Hello, ${msg.sender.mention()`)
      
    • Create a permanent mention for this user.

      Permanent* means that this mention will also contain user's access hash, so even if the user changes their username or the client forgets about that user, it can still be mentioned.

      Telegram might change access hash in some cases, so it may not exactly be permanent. The only way to actually make it permanent is to send it as a message somewhere and load it from there if needed.

      Note that some users (particularly, users with hidden forwards) may not be mentioned like this outside the chats you have in common.

      This method is only needed when the result will be stored somewhere outside current mtcute instance (e.g. saved for later use), otherwise mention will be enough.

      Note: This method doesn't format anything on its own. Instead, it returns a MessageEntity that can later be used with html or md template tags

      Note: the resulting text can only be used by clients that support mtcute notation of permanent mention links (tg://user?id=123&hash=abc).

      Also note that these permanent mentions are only valid for current account, since peer access hashes are account-specific and can't be used on another account.

      Also note that for some users such mentions might not work at all due to privacy settings.

      Parameters

      • Optionaltext: string | null

        Mention text

      Returns MessageEntity