send_paid_media()

Client.send_paid_media(chat_id: int | str, stars_amount: int, media: List[InputMediaPhoto | InputMediaVideo], caption: str = '', payload: str = None, parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None, disable_notification: bool = None, direct_messages_topic_id: int = None, reply_parameters: ReplyParameters = None, suggested_post_parameters: SuggestedPostParameters = None, schedule_date: datetime = None, protect_content: bool = None, show_caption_above_media: bool = None, business_connection_id: str = None, allow_paid_broadcast: bool = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, send_as: int | str = None, star_count: int = None, reply_to_message_id: int = None, quote_text: str = None, quote_entities: List[MessageEntity] = None, quote_offset: int = None) List[Message]

Send a group or one paid photo/video.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).

  • stars_amount (int) – The number of Telegram Stars that must be paid to buy access to the media.

  • media (List of InputMediaPhoto, InputMediaVideo) – A list describing photos and videos to be sent, must include 1–10 items.

  • caption (str, optional) – Media caption, 0-1024 characters after entities parsing.

  • invoice_payload (str) – Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.

  • parse_mode (ParseMode, optional) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together.

  • disable_notification (bool, optional) – Sends the message silently. Users will receive a notification with no sound.

  • direct_messages_topic_id (int, optional) – Unique identifier of the topic in a channel direct messages chat administered by the current user. For directs only only.

  • reply_parameters (ReplyParameters, optional) – Describes reply parameters for the message that is being sent.

  • suggested_post_parameters (SuggestedPostParameters, optional) – Information about the suggested post.

  • schedule_date (datetime, optional) – Date when the message will be automatically sent.

  • protect_content (bool, optional) – Protects the contents of the sent message from forwarding and saving.

  • show_caption_above_media (bool, optional) – Pass True, if the caption must be shown above the message media.

  • business_connection_id (str, optional) – Unique identifier of the business connection on behalf of which the message will be sent.

Returns:

List of Message – On success, a list of messages is returned.

Example

from ftmgram.types import InputMediaPhoto, InputMediaVideo

await app.send_paid_media(
    chat_id,
    stars_amount=50,
    caption="Look at this!",
    media=[
        InputMediaPhoto("photo1.jpg"),
        InputMediaPhoto("photo2.jpg"),
        InputMediaVideo("video.mp4")
    ]
)

Send paywalled photos and videos unlocked with Telegram Stars.