付费媒体

内容创作者可以通过在其频道上发布付费照片或视频来获得星星奖励。订阅者只有在向作者付费解锁后才能查看这些内容。

创作者随后可以使用 Toncoin 加密货币提取 Stars »,或者用 Stars 来宣传他们的频道并获得更多订阅者——所有这一切都无需Telegram 支付任何佣金。

发布付费媒体

channelFull#e4e0b29d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab = ChatFull;inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector<InputMedia> payload:flags.0?string = InputMedia;---functions---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;

如果设置了channelFull标志,频道管理员可以转发或发布付费媒体。paid_media_allowed

要发布付费媒体,请使用messages.sendMedia,并传入一个包含以下内容的inputMediaPaidMedia构造函数:

浏览付费媒体

messageExtendedMediaPreview#ad628cc8 flags:# w:flags.0?int h:flags.0?int thumb:flags.1?PhotoSize video_duration:flags.2?int = MessageExtendedMedia; messageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia;messageMediaPaidMedia#a8852491 stars_amount:long extended_media:Vector<MessageExtendedMedia> = MessageMedia;inputInvoiceMessage#c5b56859 peer:InputPeer msg_id:int = InputInvoice;updateMessageExtendedMedia#d5a41724 peer:Peer msg_id:int extended_media:Vector<MessageExtendedMedia> = Update; updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update;starsTransaction#13659eb0 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true business_transfer:flags.21?true stargift_resale:flags.22?true posts_search:flags.24?true stargift_prepaid_upgrade:flags.25?true id:string amount:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector<MessageMedia> subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int ads_proceeds_from_date:flags.23?int ads_proceeds_to_date:flags.23?int = StarsTransaction;---functions---messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector<int> = Updates;

付费媒体由messageMediaPaidMedia构造函数表示,该构造函数包含:

要购买付费媒体,请按照通常的付款流程»,传递一个包含付费媒体的对等方和消息 ID 的inputInvoiceMessage 。

付款成功后,将发出updateMessageExtendedMedia更新,将与该消息关联的messageExtendedMediaPreview构造函数替换为messageExtendedMedia构造函数。
如果媒体是由机器人发布的,则还会收到updateBotPurchasedPaidMedia更新。
不会发出其他更新(即,即使通过其他方式(例如messages.getHistory)重新获取相同的消息会返回已显示的 messageExtendedMedia 构造函数,也不会为包含付费媒体的消息发出updateEditChannelMessage更新)。

将生成的关联starsTransaction类型为starsTransactionPeer(peer通道等于),msg_id消息 ID 等于付费媒体,并extended_media设置为已公布的付费媒体。

注意:`updateMessageExtendedMedia`更新没有 `pts/`qts字段。
这意味着此更新只能通过套接字被动接收(参见此处 »),并且无法通过`updates.getDifference`或`updates.getChannelDifference`返回。
这意味着,如果某个客户端离线,而另一个会话购买了付费媒体,则第一个客户端在重新连接到服务器时将无法收到已披露的`messageExtendedMedia`构造函数,因此它无法得知缓存的付费媒体可以向该用户披露。

要绕过这个问题,如果: