Update content of files

This commit is contained in:
GitHub Action 2024-07-22 17:00:00 +00:00
parent 155fc0269f
commit 060655a0d8
6 changed files with 43 additions and 31 deletions

View file

@ -44,7 +44,7 @@
<div class="pr-main-intro">
<img class="pr-main-intro-img" src="/img/AdsIntro.png" width="360" height="200">
<h1 class="pr-main-intro-header">Telegram Ads</h1>
<p class="pr-main-intro-text">Every month, <b>900 million</b> Telegram users generate <b>1&nbsp;trillion views</b> in public broadcast channels.<br/><br/>Anyone can display ads in specific <b>Telegram broadcast channels</b> — using this platform.</p>
<p class="pr-main-intro-text">Every month, <b>950 million</b> Telegram users generate <b>1&nbsp;trillion views</b> in public broadcast channels.<br/><br/>Anyone can display ads in specific <b>Telegram broadcast channels</b> — using this platform.</p>
<div class="pr-main-intro-button-wrap">
<a href="/auth" class="btn pr-btn login-link">
Log in to Start Advertizing

View file

@ -44,7 +44,7 @@
<div class="pr-main-intro">
<img class="pr-main-intro-img" src="/img/AdsIntro.png" width="360" height="200">
<h1 class="pr-main-intro-header">Telegram Ads</h1>
<p class="pr-main-intro-text">Every month, <b>900 million</b> Telegram users generate <b>1&nbsp;trillion views</b> in public broadcast channels.<br/><br/>Anyone can display ads in specific <b>Telegram broadcast channels</b> — using this platform.</p>
<p class="pr-main-intro-text">Every month, <b>950 million</b> Telegram users generate <b>1&nbsp;trillion views</b> in public broadcast channels.<br/><br/>Anyone can display ads in specific <b>Telegram broadcast channels</b> — using this platform.</p>
<div class="pr-main-intro-button-wrap">
<a href="/auth" class="btn pr-btn login-link">
Log in to Start Advertizing

View file

@ -43,16 +43,16 @@
<h1 id="dev_page_title">Min constructors</h1>
<div id="dev_page_content"><p>In some situations <a href="/constructor/user">user</a> and <a href="/constructor/channel">channel</a> constructors have reduced set of fields present (although <code>id</code> is always there) and <code>min</code> flag set. This is done for performance and privacy reasons. </p>
<p>When receiving said constructors, the client must first check if user or chat object without <code>min</code> flag is already present in local cache. If it is present, then the client should just ignore constructors with <code>min</code> flag and use local one instead.</p>
<p><strong>The rest of the article assumes the client receives a min-constructor and doesn't have the full object in its local cache.</strong></p>
<p>The client must store the context (similar to <a href="/api/file_reference">file references</a>) in which the user/channel was seen. Later, when the client needs to pass the user/channel as input argument (e.g. fetch profile, mute, ban etc), the context is used to generate the <code>input*FromMessage</code> constructor, instead of normal <code>inputUser</code>, <code>inputChannel</code> or <code>inputPeer</code>.</p>
<p>When receiving said constructors, the client must first check if user or chat object without <code>min</code> flag is already present in local cache.<br>
If it is present, then the client should merge the remote and the local object, ignoring some specific fields of the remote object as specified by the <a href="/constructor/user">user</a> and <a href="/constructor/channel">channel</a> pages. </p>
<p>Additionally, the client must store the context (similar to <a href="/api/file_reference">file references</a>) in which the user/channel was seen. Later, when the client needs to pass the user/channel as input argument (e.g. passing the <code>access_hash</code> to fetch profile, mute, ban info etc), the context is used to generate the <code>input*FromMessage</code> constructor, instead of normal <code>inputUser</code>, <code>inputChannel</code> or <code>inputPeer</code>.</p>
<ul>
<li><a href="/constructor/inputPeerUserFromMessage">inputPeerUserFromMessage</a></li>
<li><a href="/constructor/inputPeerChannelFromMessage">inputPeerChannelFromMessage</a></li>
<li><a href="/constructor/inputUserFromMessage">inputUserFromMessage</a></li>
<li><a href="/constructor/inputChannelFromMessage">inputChannelFromMessage</a></li>
</ul>
<p>The <code>access_hash</code> value, if present, is only suitable to use in <a href="/constructor/inputPeerPhotoFileLocation"><code>inputPeerPhotoFileLocation</code> »</a>, to directly <a href="/api/files">download the profile pictures</a> of channels and users <strong>without</strong> having to generate an <code>inputPeer*FromMessage</code>, simply using <code>inputPeer*</code> with the specified access hash. </p>
<p>The <code>access_hash</code> value of a <code>min</code> constructor is only suitable to use in certain conditions as specified by the <a href="/constructor/user">user</a> and <a href="/constructor/channel">channel</a> pages. </p>
<p>Usually <code>min</code> constructors are encountered in messages inside of groups or channels.
When a message mentioning (sender, forwarder or forwardee, et cetera) such a user or channel is found, the constuctor must be associated with the message ID of the message and with the chat where the message was seen.</p>
<h4><a class="anchor" href="#example" id="example" name="example"><i class="anchor-icon"></i></a>Example</h4>

View file

@ -46,23 +46,33 @@
<p>Many constructors in the API need to be stored in a local database upon reception and should only ever be updated reactively (passively) when received via updates or by other means (as specified in the documentation), to avoid overloading the server by continuously requesting changes for the same unchanged information. </p>
<p><a href="/constructor/user">user</a>, <a href="/constructor/chat">chat</a>, <a href="/constructor/channel">channel</a> constructors and their full counterparts <a href="/constructor/userFull">userFull</a>, <a href="/constructor/chatFull">chatFull</a>, <a href="/constructor/channelFull">channelFull</a> are especially important, because they contain important information about users, chats and channels (from now on, <em>peers</em>), and most importantly the <code>access_hash</code> value, <strong>required</strong> to interact with peers in the API. </p>
<p>This page describes exactly how and when should the local databases of the constructors listed above be refreshed, classified in a list of access tiers. </p>
<h3><a class="anchor" href="#access-hash-tier" id="access-hash-tier" name="access-hash-tier"><i class="anchor-icon"></i></a>Access hash tier</h3>
<pre><code><a href='/constructor/user'>user</a>#215c4438 flags:<a href='/type/%23'>#</a> self:flags.10?<a href='/constructor/true'>true</a> contact:flags.11?<a href='/constructor/true'>true</a> mutual_contact:flags.12?<a href='/constructor/true'>true</a> deleted:flags.13?<a href='/constructor/true'>true</a> bot:flags.14?<a href='/constructor/true'>true</a> bot_chat_history:flags.15?<a href='/constructor/true'>true</a> bot_nochats:flags.16?<a href='/constructor/true'>true</a> verified:flags.17?<a href='/constructor/true'>true</a> restricted:flags.18?<a href='/constructor/true'>true</a> min:flags.20?<a href='/constructor/true'>true</a> bot_inline_geo:flags.21?<a href='/constructor/true'>true</a> support:flags.23?<a href='/constructor/true'>true</a> scam:flags.24?<a href='/constructor/true'>true</a> apply_min_photo:flags.25?<a href='/constructor/true'>true</a> fake:flags.26?<a href='/constructor/true'>true</a> bot_attach_menu:flags.27?<a href='/constructor/true'>true</a> premium:flags.28?<a href='/constructor/true'>true</a> attach_menu_enabled:flags.29?<a href='/constructor/true'>true</a> flags2:<a href='/type/%23'>#</a> bot_can_edit:flags2.1?<a href='/constructor/true'>true</a> close_friend:flags2.2?<a href='/constructor/true'>true</a> stories_hidden:flags2.3?<a href='/constructor/true'>true</a> stories_unavailable:flags2.4?<a href='/constructor/true'>true</a> contact_require_premium:flags2.10?<a href='/constructor/true'>true</a> bot_business:flags2.11?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:flags.0?<a href='/type/long'>long</a> first_name:flags.1?<a href='/type/string'>string</a> last_name:flags.2?<a href='/type/string'>string</a> username:flags.3?<a href='/type/string'>string</a> phone:flags.4?<a href='/type/string'>string</a> photo:flags.5?<a href='/type/UserProfilePhoto'>UserProfilePhoto</a> status:flags.6?<a href='/type/UserStatus'>UserStatus</a> bot_info_version:flags.14?<a href='/type/int'>int</a> restriction_reason:flags.18?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; bot_inline_placeholder:flags.19?<a href='/type/string'>string</a> lang_code:flags.22?<a href='/type/string'>string</a> emoji_status:flags.30?<a href='/type/EmojiStatus'>EmojiStatus</a> usernames:flags2.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Username'>Username</a>&gt; stories_max_id:flags2.5?<a href='/type/int'>int</a> color:flags2.8?<a href='/type/PeerColor'>PeerColor</a> profile_color:flags2.9?<a href='/type/PeerColor'>PeerColor</a> = <a href='/type/User'>User</a>;
<a href='/constructor/chat'>chat</a>#41cbf256 flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> left:flags.2?<a href='/constructor/true'>true</a> deactivated:flags.5?<a href='/constructor/true'>true</a> call_active:flags.23?<a href='/constructor/true'>true</a> call_not_empty:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.25?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> title:<a href='/type/string'>string</a> photo:<a href='/type/ChatPhoto'>ChatPhoto</a> participants_count:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> version:<a href='/type/int'>int</a> migrated_to:flags.6?<a href='/type/InputChannel'>InputChannel</a> admin_rights:flags.14?<a href='/type/ChatAdminRights'>ChatAdminRights</a> default_banned_rights:flags.18?<a href='/type/ChatBannedRights'>ChatBannedRights</a> = <a href='/type/Chat'>Chat</a>;
<a href='/constructor/chatForbidden'>chatForbidden</a>#6592a1a7 id:<a href='/type/long'>long</a> title:<a href='/type/string'>string</a> = <a href='/type/Chat'>Chat</a>;
<a href='/constructor/channel'>channel</a>#aadfc8f flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> left:flags.2?<a href='/constructor/true'>true</a> broadcast:flags.5?<a href='/constructor/true'>true</a> verified:flags.7?<a href='/constructor/true'>true</a> megagroup:flags.8?<a href='/constructor/true'>true</a> restricted:flags.9?<a href='/constructor/true'>true</a> signatures:flags.11?<a href='/constructor/true'>true</a> min:flags.12?<a href='/constructor/true'>true</a> scam:flags.19?<a href='/constructor/true'>true</a> has_link:flags.20?<a href='/constructor/true'>true</a> has_geo:flags.21?<a href='/constructor/true'>true</a> slowmode_enabled:flags.22?<a href='/constructor/true'>true</a> call_active:flags.23?<a href='/constructor/true'>true</a> call_not_empty:flags.24?<a href='/constructor/true'>true</a> fake:flags.25?<a href='/constructor/true'>true</a> gigagroup:flags.26?<a href='/constructor/true'>true</a> noforwards:flags.27?<a href='/constructor/true'>true</a> join_to_send:flags.28?<a href='/constructor/true'>true</a> join_request:flags.29?<a href='/constructor/true'>true</a> forum:flags.30?<a href='/constructor/true'>true</a> flags2:<a href='/type/%23'>#</a> stories_hidden:flags2.1?<a href='/constructor/true'>true</a> stories_hidden_min:flags2.2?<a href='/constructor/true'>true</a> stories_unavailable:flags2.3?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:flags.13?<a href='/type/long'>long</a> title:<a href='/type/string'>string</a> username:flags.6?<a href='/type/string'>string</a> photo:<a href='/type/ChatPhoto'>ChatPhoto</a> date:<a href='/type/int'>int</a> restriction_reason:flags.9?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; admin_rights:flags.14?<a href='/type/ChatAdminRights'>ChatAdminRights</a> banned_rights:flags.15?<a href='/type/ChatBannedRights'>ChatBannedRights</a> default_banned_rights:flags.18?<a href='/type/ChatBannedRights'>ChatBannedRights</a> participants_count:flags.17?<a href='/type/int'>int</a> usernames:flags2.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Username'>Username</a>&gt; stories_max_id:flags2.4?<a href='/type/int'>int</a> color:flags2.7?<a href='/type/PeerColor'>PeerColor</a> profile_color:flags2.8?<a href='/type/PeerColor'>PeerColor</a> emoji_status:flags2.9?<a href='/type/EmojiStatus'>EmojiStatus</a> level:flags2.10?<a href='/type/int'>int</a> = <a href='/type/Chat'>Chat</a>;
<a href='/constructor/channelForbidden'>channelForbidden</a>#17d493d5 flags:<a href='/type/%23'>#</a> broadcast:flags.5?<a href='/constructor/true'>true</a> megagroup:flags.8?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> title:<a href='/type/string'>string</a> until_date:flags.16?<a href='/type/int'>int</a> = <a href='/type/Chat'>Chat</a>;
// Full counterparts
<a href='/constructor/userFull'>userFull</a>#cc997720 flags:<a href='/type/%23'>#</a> blocked:flags.0?<a href='/constructor/true'>true</a> phone_calls_available:flags.4?<a href='/constructor/true'>true</a> phone_calls_private:flags.5?<a href='/constructor/true'>true</a> can_pin_message:flags.7?<a href='/constructor/true'>true</a> has_scheduled:flags.12?<a href='/constructor/true'>true</a> video_calls_available:flags.13?<a href='/constructor/true'>true</a> voice_messages_forbidden:flags.20?<a href='/constructor/true'>true</a> translations_disabled:flags.23?<a href='/constructor/true'>true</a> stories_pinned_available:flags.26?<a href='/constructor/true'>true</a> blocked_my_stories_from:flags.27?<a href='/constructor/true'>true</a> wallpaper_overridden:flags.28?<a href='/constructor/true'>true</a> contact_require_premium:flags.29?<a href='/constructor/true'>true</a> read_dates_private:flags.30?<a href='/constructor/true'>true</a> flags2:<a href='/type/%23'>#</a> sponsored_enabled:flags2.7?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:flags.1?<a href='/type/string'>string</a> settings:<a href='/type/PeerSettings'>PeerSettings</a> personal_photo:flags.21?<a href='/type/Photo'>Photo</a> profile_photo:flags.2?<a href='/type/Photo'>Photo</a> fallback_photo:flags.22?<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> bot_info:flags.3?<a href='/type/BotInfo'>BotInfo</a> pinned_msg_id:flags.6?<a href='/type/int'>int</a> common_chats_count:<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> ttl_period:flags.14?<a href='/type/int'>int</a> theme_emoticon:flags.15?<a href='/type/string'>string</a> private_forward_name:flags.16?<a href='/type/string'>string</a> bot_group_admin_rights:flags.17?<a href='/type/ChatAdminRights'>ChatAdminRights</a> bot_broadcast_admin_rights:flags.18?<a href='/type/ChatAdminRights'>ChatAdminRights</a> premium_gifts:flags.19?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PremiumGiftOption'>PremiumGiftOption</a>&gt; wallpaper:flags.24?<a href='/type/WallPaper'>WallPaper</a> stories:flags.25?<a href='/type/PeerStories'>PeerStories</a> business_work_hours:flags2.0?<a href='/type/BusinessWorkHours'>BusinessWorkHours</a> business_location:flags2.1?<a href='/type/BusinessLocation'>BusinessLocation</a> business_greeting_message:flags2.2?<a href='/type/BusinessGreetingMessage'>BusinessGreetingMessage</a> business_away_message:flags2.3?<a href='/type/BusinessAwayMessage'>BusinessAwayMessage</a> business_intro:flags2.4?<a href='/type/BusinessIntro'>BusinessIntro</a> birthday:flags2.5?<a href='/type/Birthday'>Birthday</a> personal_channel_id:flags2.6?<a href='/type/long'>long</a> personal_channel_message:flags2.6?<a href='/type/int'>int</a> = <a href='/type/UserFull'>UserFull</a>;
<a href='/constructor/chatFull'>chatFull</a>#2633421b flags:<a href='/type/%23'>#</a> can_set_username:flags.7?<a href='/constructor/true'>true</a> has_scheduled:flags.8?<a href='/constructor/true'>true</a> translations_disabled:flags.19?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants:<a href='/type/ChatParticipants'>ChatParticipants</a> chat_photo:flags.2?<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.13?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; pinned_msg_id:flags.6?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> call:flags.12?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.14?<a href='/type/int'>int</a> groupcall_default_join_as:flags.15?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.16?<a href='/type/string'>string</a> requests_pending:flags.17?<a href='/type/int'>int</a> recent_requesters:flags.17?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; available_reactions:flags.18?<a href='/type/ChatReactions'>ChatReactions</a> reactions_limit:flags.20?<a href='/type/int'>int</a> = <a href='/type/ChatFull'>ChatFull</a>;
<a href='/constructor/channelFull'>channelFull</a>#bbab348d flags:<a href='/type/%23'>#</a> can_view_participants:flags.3?<a href='/constructor/true'>true</a> can_set_username:flags.6?<a href='/constructor/true'>true</a> can_set_stickers:flags.7?<a href='/constructor/true'>true</a> hidden_prehistory:flags.10?<a href='/constructor/true'>true</a> can_set_location:flags.16?<a href='/constructor/true'>true</a> has_scheduled:flags.19?<a href='/constructor/true'>true</a> can_view_stats:flags.20?<a href='/constructor/true'>true</a> blocked:flags.22?<a href='/constructor/true'>true</a> flags2:<a href='/type/%23'>#</a> can_delete_channel:flags2.0?<a href='/constructor/true'>true</a> antispam:flags2.1?<a href='/constructor/true'>true</a> participants_hidden:flags2.2?<a href='/constructor/true'>true</a> translations_disabled:flags2.3?<a href='/constructor/true'>true</a> stories_pinned_available:flags2.5?<a href='/constructor/true'>true</a> view_forum_as_messages:flags2.6?<a href='/constructor/true'>true</a> restricted_sponsored:flags2.11?<a href='/constructor/true'>true</a> can_view_revenue:flags2.12?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:<a href='/type/string'>string</a> participants_count:flags.0?<a href='/type/int'>int</a> admins_count:flags.1?<a href='/type/int'>int</a> kicked_count:flags.2?<a href='/type/int'>int</a> banned_count:flags.2?<a href='/type/int'>int</a> online_count:flags.13?<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> chat_photo:<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> exported_invite:flags.23?<a href='/type/ExportedChatInvite'>ExportedChatInvite</a> bot_info:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/BotInfo'>BotInfo</a>&gt; migrated_from_chat_id:flags.4?<a href='/type/long'>long</a> migrated_from_max_id:flags.4?<a href='/type/int'>int</a> pinned_msg_id:flags.5?<a href='/type/int'>int</a> stickerset:flags.8?<a href='/type/StickerSet'>StickerSet</a> available_min_id:flags.9?<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> linked_chat_id:flags.14?<a href='/type/long'>long</a> location:flags.15?<a href='/type/ChannelLocation'>ChannelLocation</a> slowmode_seconds:flags.17?<a href='/type/int'>int</a> slowmode_next_send_date:flags.18?<a href='/type/int'>int</a> stats_dc:flags.12?<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> call:flags.21?<a href='/type/InputGroupCall'>InputGroupCall</a> ttl_period:flags.24?<a href='/type/int'>int</a> pending_suggestions:flags.25?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/string'>string</a>&gt; groupcall_default_join_as:flags.26?<a href='/type/Peer'>Peer</a> theme_emoticon:flags.27?<a href='/type/string'>string</a> requests_pending:flags.28?<a href='/type/int'>int</a> recent_requesters:flags.28?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/long'>long</a>&gt; default_send_as:flags.29?<a href='/type/Peer'>Peer</a> available_reactions:flags.30?<a href='/type/ChatReactions'>ChatReactions</a> reactions_limit:flags2.13?<a href='/type/int'>int</a> stories:flags2.4?<a href='/type/PeerStories'>PeerStories</a> wallpaper:flags2.7?<a href='/type/WallPaper'>WallPaper</a> boosts_applied:flags2.8?<a href='/type/int'>int</a> boosts_unrestrict:flags2.9?<a href='/type/int'>int</a> emojiset:flags2.10?<a href='/type/StickerSet'>StickerSet</a> = <a href='/type/ChatFull'>ChatFull</a>;</code></pre></div>
<p>This page describes exactly how and when should the local databases of the constructors listed above be refreshed. </p>
<h3><a class="anchor" href="#peer-info-database" id="peer-info-database" name="peer-info-database"><i class="anchor-icon"></i></a>Peer info database</h3>
<p>The peer info database needs to be updated every time a new constructor of type <a href="/constructor/user">user</a>, <a href="/constructor/chat">chat</a> and <a href="/constructor/channel">channel</a> is received. </p>
<p>The peer info database contains: </p>
<ul>
<li>
<p>The <code>id</code>, a unique 64-bit ID used to identify a specific user, chat or channel.<br>
This field should be used as primary key in the channel, chat and user databases. </p>
<p>Note that the ID sequences of users, chats and channels may overlap, so you must either:</p>
<ul>
<li>Use separate tables/hashmaps for <a href="/constructor/user">user</a>s, <a href="/constructor/chat">chat</a>s and <a href="/constructor/channel">channel</a>s OR</li>
<li>Transform the peer IDs to bot API IDs as specified <a href="/api/bots/ids">here »</a>, which will allow you to use a single ID sequence (and database) for all three peer types, maintaining uniqueness.<br>
In this case, a single table <em>can</em> be used for all peer types, but since the structures of the constructors are different, to avoid useless typechecks it might be a good idea to use three tables, as with the first approach. </li>
</ul>
<p>It's a good idea to transform peer IDs to <a href="/api/bots/ids">bot API IDs</a> even if you do decide to use separate databases, as it will make IDs more visually recognizable both for you and your users, as well as guarantee compatibility with the bot API.</p>
</li>
<li>
<p>The <code>access_hash</code>, the second most important field of all, used to generate <a href="/type/InputPeer">InputPeer</a>, <a href="/type/inputUser">inputUser</a>, <a href="/type/inputChat">inputChat</a>, <a href="/type/inputChannel">inputChannel</a> constructors used to interact with peers in the API.<br>
Note that <a href="/constructor/chat">chat</a>s (<a href="/api/channel">basic groups »</a>) do not have an access hash.<br>
<a href="/constructor/user">user</a>s and <a href="/constructor/channel">channel</a>s (<a href="/api/channel">supergroups and channels »</a>) have an access hash, but it can come in three flavors:</p>
<ul>
<li>Full access hash: can be used everywhere in the API.</li>
<li>Min access hash: received from <a href="/api/min">min constructors »</a>, can only be used to fetch the profile pictures using <a href="/constructor/inputPeerPhotoFileLocation"><code>inputPeerPhotoFileLocation</code> »</a>. </li>
<li>Zero access hash: equal to <code>0</code>, may only be used by bots as fallback in certain conditions if a full or min access hash is not available in the database yet.</li>
</ul>
</li>
</ul></div>
</div>

View file

@ -42,7 +42,9 @@
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/user" >user</a></li></ul></div>
<h1 id="dev_page_title">user</h1>
<div id="dev_page_content"><p>Indicates info about a certain user</p>
<div id="dev_page_content"><p>Indicates info about a certain user.</p>
<p>Unless specified otherwise, when updating the <a href="/api/peers">local peer database</a>, all fields from the newly received constructor take priority over the old constructor cached locally (including by removing fields that aren't set in the new constructor). </p>
<p>See <a href="https://github.com/tdlib/td/blob/cb164927417f22811c74cd8678ed4a5ab7cb80ba/td/telegram/UserManager.cpp#L2267">here »</a> for an implementation of the logic to use when updating the <a href="/api/peers">local user peer database</a>. </p>
<p><div class="clearfix">
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
<li class="dropdown">
@ -79,7 +81,7 @@
<tr>
<td><strong>contact</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.11?<a href="/constructor/true">true</a></td>
<td>Whether this user is a contact</td>
<td>Whether this user is a contact <br>When updating the <a href="/api/peers">local peer database</a>, do not apply changes to this field if the <code>min</code> flag is set.</td>
</tr>
<tr>
<td><strong>mutual_contact</strong></td>
@ -94,7 +96,7 @@
<tr>
<td><strong>bot</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.14?<a href="/constructor/true">true</a></td>
<td>Is this user a bot?</td>
<td>Is this user a bot? <br>Changes to this flag should invalidate the local <a href="/constructor/userFull">userFull</a> cache for this user ID.</td>
</tr>
<tr>
<td><strong>bot_chat_history</strong></td>
@ -154,7 +156,7 @@
<tr>
<td><strong>premium</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.28?<a href="/constructor/true">true</a></td>
<td>Whether this user is a Telegram Premium user</td>
<td>Whether this user is a Telegram Premium user <br>Changes to this flag should invalidate the local <a href="/constructor/userFull">userFull</a> cache for this user ID. <br>Changes to this flag if the <code>self</code> flag is set should also trigger the following calls, to refresh the respective caches: <br>- <a href="/method/help.getConfig">help.getConfig</a> <br>- <a href="/method/messages.getTopReactions">messages.getTopReactions</a> if the <code>bot</code> flag is <strong>not</strong> set</td>
</tr>
<tr>
<td><strong>attach_menu_enabled</strong></td>
@ -169,7 +171,7 @@
<tr>
<td><strong>bot_can_edit</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags2</a>.1?<a href="/constructor/true">true</a></td>
<td>Whether we can edit the profile picture, name, about text and description of this bot because we own it. <br>When updating the <a href="/api/peers">local peer database</a>, do not apply changes to this field if the <code>min</code> flag is set.</td>
<td>Whether we can edit the profile picture, name, about text and description of this bot because we own it. <br>When updating the <a href="/api/peers">local peer database</a>, do not apply changes to this field if the <code>min</code> flag is set. <br>Changes to this flag (if <code>min</code> is not set) should invalidate the local <a href="/constructor/userFull">userFull</a> cache for this user ID.</td>
</tr>
<tr>
<td><strong>close_friend</strong></td>
@ -204,7 +206,7 @@
<tr>
<td><strong>access_hash</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.0?<a href="/type/long">long</a></td>
<td>Access hash of the user. <br>When updating the <a href="/api/peers">local peer database</a>, generate a virtual flag called <code>min_access_hash</code>, which is: <br>- Set to <code>true</code> if <code>min</code> is set AND <br>   - The <code>phone</code> <em>flag</em> is <strong>not</strong> set OR <br>   - The <code>phone</code> <em>flag</em> is set and the associated phone number string is <strong>non-empty</strong> <br>- Set to <code>false</code> otherwise. <br><br>Then, apply both <code>access_hash</code> and <code>min_access_hash</code> to the local database if: <br>- <code>min_access_hash</code> is false <!-- OR <br>- `min_access_hash` is true AND <br>&nbsp; &nbsp;- There is no locally cached object for this user OR <br>&nbsp; &nbsp;- The cached object's `min_access_hash` is also true. <br>Note that an access hash may not be used in the API if the `min_access_hash` field is equal to `true`. --></td>
<td>Access hash of the user. <br>If this flag is set, when updating the <a href="/api/peers">local peer database</a>, generate a virtual flag called <code>min_access_hash</code>, which is: <br>- Set to <code>true</code> if <code>min</code> is set AND <br>   - The <code>phone</code> <em>flag</em> is <strong>not</strong> set OR <br>   - The <code>phone</code> <em>flag</em> is set and the associated phone number string is <strong>non-empty</strong> <br>- Set to <code>false</code> otherwise. <br><br>Then, apply both <code>access_hash</code> and <code>min_access_hash</code> to the local database if: <br>- <code>min_access_hash</code> is false OR <br>- <code>min_access_hash</code> is true AND <br>   - There is no locally cached object for this user OR <br>   - There is no <code>access_hash</code> in the local cache OR <br>   - The cached object's <code>min_access_hash</code> is also true <br>If the final merged object stored to the database has the <code>min_access_hash</code> field set to true, the related <code>access_hash</code> is <strong>only</strong> suitable to use in <a href="/constructor/inputPeerPhotoFileLocation"><code>inputPeerPhotoFileLocation</code> »</a>, to directly <a href="/api/files">download the profile pictures</a> of users, everywhere else a <code>inputPeer*FromMessage</code> constructor will have to be generated as specified <a href="/api/min">here »</a>. <br>Bots can also use min access hashes in some conditions, by passing <code>0</code> instead of the min access hash.</td>
</tr>
<tr>
<td><strong>first_name</strong></td>
@ -264,7 +266,7 @@
<tr>
<td><strong>usernames</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags2</a>.0?<a href="/type/Vector%20t">Vector</a>&lt;<a href="/type/Username">Username</a>&gt;</td>
<td>Additional usernames. <br>When updating the <a href="/api/peers">local peer database</a>, apply changes to this field only if: <br>- The <code>min</code> flag is not set OR <br>- The <code>min</code> flag is set AND <br>   - The <code>min</code> flag of the locally cached user entry is set.</td>
<td>Additional usernames. <br>When updating the <a href="/api/peers">local peer database</a>, apply changes to this field only if: <br>- The <code>min</code> flag is not set OR <br>- The <code>min</code> flag is set AND <br>   - The <code>min</code> flag of the locally cached user entry is set. <br>Changes to this flag (if the above conditions are respected) should invalidate the local <a href="/constructor/userFull">userFull</a> cache for this user ID.</td>
</tr>
<tr>
<td><strong>stories_max_id</strong></td>

View file

@ -170,7 +170,7 @@ Check out our Advanced FAQ for more technical information.…">
<hr>
<h3><a class="anchor" name="general-questions" href="#general-questions"><i class="anchor-icon"></i></a>General Questions</h3>
<h4><a class="anchor" name="q-what-is-telegram-what-do-i-do-here" href="#q-what-is-telegram-what-do-i-do-here"><i class="anchor-icon"></i></a>Q: What is Telegram? What do I do here?</h4>
<p>Telegram is a messaging app with a focus on speed and security, its super-fast, simple and free. You can use Telegram on all your devices <strong>at the same time</strong> — your messages sync seamlessly across any number of your phones, tablets or computers. Telegram has over <strong>900 million</strong> monthly active users and is one of the <strong>10 most downloaded apps</strong> in the world.</p>
<p>Telegram is a messaging app with a focus on speed and security, its super-fast, simple and free. You can use Telegram on all your devices <strong>at the same time</strong> — your messages sync seamlessly across any number of your phones, tablets or computers. Telegram is one of the <strong>top 5 most downloaded apps</strong> in the world with over <strong>950 million</strong> active users. </p>
<p>With Telegram, you can send messages, photos, videos and <a href="/blog/shared-files"><strong>files</strong></a> of any type (doc, zip, mp3, etc), as well as create groups for up to <strong>200,000</strong> people or <a href="/blog/channels">channels</a> for broadcasting to <strong>unlimited</strong> audiences. You can write to your phone contacts and find people by their <a href="#usernames-and-t-me"><strong>usernames</strong></a>. As a result, Telegram is like SMS and email combined — and can take care of all your personal or business messaging needs. In addition to this, we support end-to-end encrypted <a href="https://telegram.org/blog/calls"><strong>voice</strong></a> and <a href="https://telegram.org/blog/video-calls"><strong>video calls</strong></a>, as well as <a href="https://telegram.org/blog/voice-chats"><strong>voice chats in groups</strong></a> for thousands of participants.</p>
<blockquote>
<p>Follow our <a href="https://t.me/TelegramTips"><strong>Tips Channel</strong></a> to learn more about Telegram features.</p>