电报隐私设置
Telegram 允许用户指定精细的隐私设置,选择哪些用户可以或不可以以某些方式与他们互动。
隐私规则
模式:
inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule; inputPrivacyValueAllowChatParticipants#840649cf chats:Vector<long> = InputPrivacyRule; inputPrivacyValueDisallowChatParticipants#e94f0f86 chats:Vector<long> = InputPrivacyRule; inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule; inputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule; inputPrivacyValueAllowBots#5a4fcce5 = InputPrivacyRule; inputPrivacyValueDisallowBots#c4e57915 = InputPrivacyRule;privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; privacyValueAllowUsers#b8905fb2 users:Vector<long> = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#e4621141 users:Vector<long> = PrivacyRule; privacyValueAllowChatParticipants#6b134e8e chats:Vector<long> = PrivacyRule; privacyValueDisallowChatParticipants#41c87565 chats:Vector<long> = PrivacyRule; privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule; privacyValueAllowPremium#ece9814b = PrivacyRule; privacyValueAllowBots#21461b5d = PrivacyRule; privacyValueDisallowBots#f6a5f82f = PrivacyRule;user#20b1422 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;---functions---contacts.editCloseFriends#ba6705f0 id:Vector<long> = Bool;
隐私规则指示谁可以或不可以执行某些操作,并由PrivacyRule及其输入对应物InputPrivacyRule指定。InputPrivacyRule
构造函数作为输入传递给接受隐私规则的方法,而PrivacyRule则包含在API返回的构造函数中。
请参阅类型页面»以获取完整的隐私规则及其说明列表。
特别需要单独提及一条隐私规则,即 (input)privacyValueAllowCloseFriends:这条隐私规则只能在发布故事时使用,它专门指“密友”列表,可以使用contacts.editCloseFriends修改该列表,并将完整的密友列表作为用户 ID 列表传递:请注意,只有联系人列表中的用户(即使没有电话号码)才能添加到密友列表中。
当前亲密好友列表可以通过检查联系人列表中哪些用户close_friend在关联的用户构造函数中设置了该标志来获取,请参阅此处»以了解有关如何获取联系人列表的更多信息。
隐私密钥
模式:
inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey; inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey; inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey; inputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey; inputPrivacyKeyVoiceMessages#aee69d68 = InputPrivacyKey; inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey; inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey; inputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey; inputPrivacyKeyNoPaidMessages#bdc597b4 = InputPrivacyKey;privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; privacyKeyPhoneP2P#39491cc8 = PrivacyKey; privacyKeyForwards#69ec56a3 = PrivacyKey; privacyKeyProfilePhoto#96151fed = PrivacyKey; privacyKeyPhoneNumber#d19ae46d = PrivacyKey; privacyKeyAddedByPhone#42ffd42b = PrivacyKey; privacyKeyVoiceMessages#697f414 = PrivacyKey; privacyKeyAbout#a486b761 = PrivacyKey; privacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey; privacyKeyNoPaidMessages#17d348d2 = PrivacyKey;account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;---functions---account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;
隐私密钥和隐私规则共同指示某人可以做什么或不可以做什么,它们由 PrivacyKey 构造函数及其输入对应物 InputPrivacyKey 指定。InputPrivacyKey构造函数作为输入传递给接受隐私密钥的方法,而PrivacyKey则包含在API返回的构造函数中。
请参阅类型页面»以获取隐私密钥及其说明的完整列表。
使用account.getPrivacy获取与密钥关联的当前规则集,使用account.setPrivacy更改它。
更改隐私设置将触发updatePrivacy消息,该消息将发送到当前帐户的所有已登录会话。
全局隐私设置
globalPrivacySettings#fe41b34f flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true display_gifts_button:flags.7?true noncontact_peers_paid_stars:flags.5?long disallowed_gifts:flags.6?DisallowedGiftsSettings = GlobalPrivacySettings;---functions---account.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings; account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings;
也可以使用account.getGlobalPrivacySettings和account.setGlobalPrivacySettings获取和修改一些全局隐私设置。
全局隐私设置由globalPrivacySettings构造函数表示,请参阅构造函数页面以获取所有设置的完整说明。
新用户(非联系用户)需购买高级会员。
requirementToContactEmpty#50a9839 = RequirementToContact; requirementToContactPremium#e581e4e9 = RequirementToContact; requirementToContactPaidMessages#b4f67e93 stars_amount:long = RequirementToContact;user#20b1422 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;userFull#c577b5ad flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true display_gifts_button:flags2.16?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme:flags.15?ChatTheme private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings stars_rating:flags2.17?StarsRating stars_my_pending_rating:flags2.18?StarsRating stars_my_pending_rating_date:flags2.18?int main_tab:flags2.20?ProfileTab saved_music:flags2.21?Document = UserFull;---functions---users.getRequirementsToContact#d89a83a3 id:Vector<InputUser> = Vector<RequirementToContact>;
如果用户启用其全局隐私设置。new_noncontact_peers_require_premium全局隐私设置(在用户中表示),则对于其他用户,只有拥有高级帐户、在我们的联系人列表中或已经与他们进行过私聊的用户才能私下给他们写信;否则将发出错误。contact_require_premium403 PRIVACY_PREMIUM_REQUIRED
请注意,即使已为某个用户设置了 `user.` 标志(例如,即使我们仍然可以向共同联系人写入数据,该标志也会被设置,以此类推……),上述所有次要条件都必须单独检查,以验证我们是否仍然可以向该contact_require_premium用户写入数据。为了避免在尚未缓存所有必需信息时(例如,在共享 UI 中显示聊天列表时)执行这些额外的检查,可以改为调用`users.getRequirementsToContact`方法,并传入当前 UI 中可见的用户列表,该方法返回一个条件列表(包括`requirementToContactPremium`),这些条件直接指定我们是否可以向每个用户写入数据。
或者,`userFull.`标志包含与`users.getRequirementsToContact`返回的相同信息(已完全检查,即它不仅仅是`user.`contact_require_premium的副本)。contact_require_premium
例如,我们可以利用这些信息,在每个我们无法写入的用户的头像附近显示一个锁,并附带一个相应的工具提示,引导用户购买高级订阅。
请注意,只有在我们没有高级订阅的情况下,并且仅对尚未缓存完整信息(userFull+ 消息历史记录信息)的用户调用users.getRequirementsToContact,因为如果所有提到的信息都可用,则可以在本地计算相同的信息,并使用通常的更新自动更新。
另请注意,只有当 `new_noncontact_peers_require_premium_without_ownpremium` 客户端配置标志“»”等于 true 时,非高级用户和高级用户才能启用 `globalPrivacySettings.new_noncontact_peers_require_premium`选项;否则,只有高级用户才能启用此选项,非高级用户在尝试使用`account.setGlobalPrivacySettings`启用此标志时会收到错误。PREMIUM_ACCOUNT_REQUIRED
需要支付 Telegram Star 费用才能接收消息
如果用户启用了全局noncontact_peers_paid_stars隐私设置,任何想要向其发送消息的人都必须支付指定数量的Telegram 星币。
同样的设置也可以应用于超级群组和频道,请参阅此处»以获取有关付费消息的完整文档。