付费信息
电报Telegram Stars 可用于向已配置Star Messages »的用户、超级群组和频道发送消息,每发送一条消息都需要付费。
切换付费消息
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;peerSettings#f47741f7 flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true business_bot_paused:flags.11?true business_bot_can_reply:flags.12?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int business_bot_id:flags.13?long business_bot_manage_url:flags.13?string charge_paid_message_stars:flags.14?long registration_month:flags.15?string phone_country:flags.16?string name_change_date:flags.17?int photo_change_date:flags.18?int = PeerSettings;inputPrivacyKeyNoPaidMessages#bdc597b4 = InputPrivacyKey;privacyKeyNoPaidMessages#17d348d2 = PrivacyKey;account.paidMessagesRevenue#1e109708 stars_amount:long = account.PaidMessagesRevenue;messageActionPaidMessagesRefunded#ac1f1fcd count:int stars:long = MessageAction;messageActionPaidMessagesPrice#84b88578 flags:# broadcast_messages_allowed:flags.0?true stars:long = MessageAction;updateMonoForumNoPaidException#9f812b08 flags:# exception:flags.0?true channel_id:long saved_peer_id:Peer = Update;---functions---account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings; channels.updatePaidMessagesPrice#4b12327b flags:# broadcast_messages_allowed:flags.0?true channel:InputChannel send_paid_messages_stars:long = Updates;account.toggleNoPaidMessagesException#fe2eda76 flags:# refund_charged:flags.0?true require_payment:flags.2?true parent_peer:flags.1?InputPeer user_id:InputUser = Bool;messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;account.getPaidMessagesRevenue#19ba4a67 flags:# parent_peer:flags.0?InputPeer user_id:InputUser = account.PaidMessagesRevenue;
您可以指定发送消息所需的星星数量:
- 对于发送给我们的私人消息,可以在全局noncontact_peers_paid_stars隐私设置中启用;只有当stars_paid_messages_available等于 true 时才能切换。
-
对于超级群组和频道私信,使用channels.updatePaidMessagesPrice。选择频道私信
价格时,用户界面应显示stars_paid_messages_channel_amount_default »作为初始默认值。
允许的最大星星数量在stars_paid_message_amount_max »中指定。
启用付费消息功能后,只有以下用户无需付费即可向我们发送消息:
-
私信内容:
- 我们联系人列表中的用户
- 我们首先联系的用户
-
我们已明确豁免部分用户付费,方法是使用inputPrivacyKeyNoPaidMessages 隐私设置 »和inputPrivacyValueAllowUsers。请注意,我们还可以使用inputPrivacyValueAllowChatParticipants (通过min locations »实现)
豁免所有首次通过聊天消息联系我们的用户付费。 -
我们已明确豁免某些用户无需付费,方法是使用account.toggleNoPaidMessagesException:这只是另一种编辑单个节点的inputPrivacyKeyNoPaidMessages隐私允许列表的方法,无需获取完整的当前列表。
请注意,此方法只能将用户添加到inputPrivacyValueAllowUsers允许列表中,而不能从中删除用户。
所有需要付费才能向我们发送私信的用户,其peerSettingscharge_paid_message_stars标志将仅对我们启用,其中包含所需的星级数量。
-
对于超级组合:
- 仅当设置了channelFull时,管理员才能访问。paid_messages_available
-
向频道(又名 monoforums)发送私信 »:
-
我们已明确地使用`account.toggleNoPaidMessagesException` 方法将某些用户排除在付费之外,并将parent_peer该用户的 ID 设置为该 Monoforum 的 ID。被
排除的用户将设置`monoForumDialog.`nopaid_messages_exception标志,并且任何更改都会向其他 Monoforum 管理员以及当前登录的 Monoforum 管理员的其他会话发出`updateMonoForumNoPaidException`
异常。 请注意,与用户不同,在对 Monoforum 执行操作时,此方法既可以添加用户到允许列表中,也可以从中删除用户。
-
我们已明确地使用`account.toggleNoPaidMessagesException` 方法将某些用户排除在付费之外,并将parent_peer该用户的 ID 设置为该 Monoforum 的 ID。被
启用、禁用或更改付费消息的价格将向相关的私人聊天、超级群组或频道(后者用于关联的单体论坛中的直接消息) 发出messageActionPaidMessagesPrice服务消息。
收到的星星数量等于发送的星星数量乘以stars_paid_message_commission_permille再除以 1000。
account.getPaidMessagesRevenue可用于获取用户通过直接或通过频道向我们发送消息所花费的未退款 Telegram Star 的总数,根据该值parent_peer。
使用account.toggleNoPaidMessagesException时,refund_charged可以设置标志来退还用户已支付给我们发送消息的所有尚未退款的星星(直接支付或通过 monoforum 支付;可以使用account.getPaidMessagesRevenue获取确切的数字):这将发出messageActionPaidMessagesRefunded服务消息。
发送付费消息
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; channel#fe685355 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true autotranslation:flags2.15?true broadcast_messages_allowed:flags2.16?true monoforum:flags2.17?true forum_tabs:flags2.19?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long send_paid_messages_stars:flags2.14?long linked_monoforum_id:flags2.18?long = Chat; 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;message#9815cec8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true paid_suggested_post_stars:flags2.8?true paid_suggested_post_ton:flags2.9?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long suggested_post:flags2.7?SuggestedPost = Message;---functions---users.getRequirementsToContact#d89a83a3 id:Vector<InputUser> = Vector<RequirementToContact>;messages.sendMessage#fe05dc9a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long suggested_post:flags.22?SuggestedPost = Updates; messages.sendMedia#ac55d9c1 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long suggested_post:flags.22?SuggestedPost = Updates; messages.forwardMessages#978928ca flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer top_msg_id:flags.9?int reply_to:flags.22?InputReplyTo schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int allow_paid_stars:flags.21?long suggested_post:flags.23?SuggestedPost = Updates; messages.sendInlineBotResult#c0cf7646 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut allow_paid_stars:flags.21?long = Updates; messages.sendMultiMedia#1bf89d74 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long = Updates;
任何想要向已配置付费消息的对等方发送消息的人,»必须支付所需数量的Telegram Stars,»通过在messages.sendMessageallow_paid_stars的参数中指定所需数量来支付,以及所有其他用于发送或转发消息的方法。
要检查对等节点是否需要付费才能接收消息,请检查是否存在以下标志:
- 用户。send_paid_messages_stars面向用户
- 频道。send_paid_messages_stars(仅限单论坛的 ID,不包含关联频道的 ID)
这些标志将包含向该对等节点发送消息 所需的星号数量。
但请注意,上述标记并未表明我们是否因上述任何原因被明确豁免付款 »:此信息包含在:
- send_paid_messages_stars用户完整版。
- channelFull.send_paid_messages_stars适用于单体论坛(包括单体论坛的 ID 和关联频道的 ID)
这些标志将包含向该对等节点发送消息所需的星星数量,或者0(该标志将被设置)如果我们获得豁免;对于不需要付费即可接收消息的对等节点,该标志不会被设置。
如果尚未缓存,则只需获取userFull/channelFull构造函数:
- 如果用户/频道已send_paid_messages_stars设置且send_paid_messages_stars
- 客户端当前正在与用户进行私聊/向指定的 Monoforum 发送消息时显示消息栏,或者显示与向对等方发送消息相关的其他 UI 元素。
如果客户端需要send_paid_messages_stars批量获取多个用户的标记,例如在共享 UI 中显示聊天列表时(在每个需要付款的用户头像附近显示货币符号,并附带相应的提示信息),则可以调用users.getRequirementsToContact方法,传入当前 UI 中可见的用户列表,该方法返回一个条件列表(包括带有标记值的requirementsToContactPaidMessages);此方法不能用于 monoforums,monoforums 应像往常一样使用channels.getFullChannel(如果尚未缓存)。
请注意,`users.getRequirementsToContact`仅应针对尚未缓存完整信息(`userFull`/ `channelFull`)的用户调用,因为如果所有提及的信息都可用,则可以在本地计算相同的信息。
此外,它不能用于超级群组和单体论坛,对于这些群组和论坛,请改为获取完整的`channelFull`信息(如果未缓存,或者为了避免执行过多查询,只需处理ALLOW_PAYMENT_REQUIRED_%d向付费单体论坛发送消息时未付费而导致的问题即可)。
如果付费消息功能已启用但未设置相应标志,或者传入的金额allow_paid_stars小于所需金额(例如,所需金额已更改但尚未收到更改通知),ALLOW_PAYMENT_REQUIRED_%d则尝试发送消息时会发出代码为 403 的 RPC 错误,并%d指示正确的所需星星数量。
此外,如果传入的金额allow_paid_stars大于实际所需金额(同样,如果所需金额最近已更改),则只会收取实际所需数量的星星(如果付费消息功能已禁用,则不收取任何星星)。
发送者支付的星星数量(即不是收到的星星数量,无论stars_paid_message_commission_permille »的值如何,发送者和接收者的标志都将相同)将在消息paid_message_stars标志中指定。