Story

class ftmgram.types.Story(*, client: Client = None, id: int, from_user: User | None = None, sender_chat: Chat | None = None, date: datetime | None = None, chat: Chat | None = None, forward_from: User | None = None, forward_sender_name: str | None = None, forward_from_chat: Chat | None = None, forward_from_story_id: int | None = None, expire_date: datetime | None = None, media: MessageMediaType | None = None, has_protected_content: bool | None = None, photo: Photo | None = None, video: Video | None = None, edited: bool | None = None, pinned: bool | None = None, public: bool | None = None, close_friends: bool | None = None, contacts: bool | None = None, selected_contacts: bool | None = None, caption: str | None = None, caption_entities: List[MessageEntity] | None = None, views: int | None = None, forwards: int | None = None, outgoing: bool | None = None, privacy: StoriesPrivacyRules | None = None, allowed_users: List[int | str] | None = None, disallowed_users: List[int | str] | None = None, reactions: List[Reaction] | None = None, reactions_count: int | None = None, skipped: bool | None = None, deleted: bool | None = None, media_areas: List[MediaArea] | None = None, raw: StoryItem | None = None)

A story.

Parameters:
  • id (int) – Unique story identifier.

  • from_user (User, optional) – Sender of the story.

  • sender_chat (Chat, optional) – Sender of the story, sent on behalf of a chat.

  • date (datetime, optional) – Date the story was sent.

  • chat (Chat, optional) – Conversation the story belongs to.

  • forward_from (User, optional) – For forwarded stories, sender of the original story.

  • forward_sender_name (str, optional) – For stories forwarded from users who have hidden their accounts, name of the user.

  • forward_from_chat (Chat, optional) – For stories forwarded from channels, information about the original channel.

  • forward_from_story_id (int, optional) – For stories forwarded from channels, identifier of the original story in the channel.

  • expire_date (datetime, optional) – Date the story will be expired.

  • media (MessageMediaType, optional) – The media type of the Story. This field will contain the enumeration type of the media message. You can use media = getattr(story, story.media.value) to access the media message.

  • has_protected_content (bool, optional) – True, if the story can’t be forwarded.

  • photo (Photo, optional) – Story is a photo, information about the photo.

  • video (Video, optional) – Story is a video, information about the video.

  • edited (bool, optional) – True, if the Story has been edited.

  • pinned (bool, optional) – True, if the Story is pinned.

  • public (bool, optional) – True, if the Story is shared with public.

  • close_friends (bool, optional) – True, if the Story is shared with close_friends only.

  • contacts (bool, optional) – True, if the Story is shared with contacts only.

  • selected_contacts (bool, optional) – True, if the Story is shared with selected contacts only.

  • caption (str, optional) – Caption for the Story, 0-1024 characters.

  • caption_entities (List of MessageEntity, optional) – For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the caption.

  • views (int, optional) – Stories views.

  • forwards (int, optional) – Stories forwards.

  • outgoing (bool, optional) – Whether the story is incoming or outgoing. Story received from others are incoming (outgoing is False). Story sent from yourself are outgoing (outgoing is True).

  • privacy (StoriesPrivacyRules, optional) – Story privacy.

  • allowed_users (List of int | str, optional) – List of user_ids or chat_ids whos allowed to view the story.

  • disallowed_users (List of int | str, optional) – List of user_ids whos denied to view the story.

  • reactions (List of Reaction) – List of the reactions to this story.

  • reactions_count (int, optional) – Reactions count.

  • skipped (bool, optional) – The story is skipped. A story can be skipped in case it was skipped.

  • deleted (bool, optional) – The story is deleted. A story can be deleted in case it was deleted or you tried to retrieve a story that doesn’t exist yet.

  • media_areas (List of MediaArea, optional) – List of media areas.

  • raw (StoryItem, optional) – The raw story object, as received from the Telegram API.

reply_text(text: str, parse_mode: ParseMode | None = None, entities: List[MessageEntity] = None, link_preview_options: LinkPreviewOptions = None, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, protect_content: bool = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, disable_web_page_preview: bool = None) Message

Bound method reply_text of Story.

An alias exists as reply.

Use as a shortcut for:

await client.send_message(
    chat_id=story.chat.id,
    text="hello",
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_text("hello")
Parameters:
  • text (str) – Text of the message to be sent.

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

  • entities (List of MessageEntity) – List of special entities that appear in message text, which can be specified instead of parse_mode.

  • link_preview_options (LinkPreviewOptions, optional) – Options used for link preview generation for the message.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

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

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

Returns:

On success, the sent Message is returned.

Raises:

RPCError – In case of a Telegram RPC error.

reply(text: str, parse_mode: ParseMode | None = None, entities: List[MessageEntity] = None, link_preview_options: LinkPreviewOptions = None, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, protect_content: bool = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, disable_web_page_preview: bool = None) Message

Bound method reply_text of Story.

An alias exists as reply.

Use as a shortcut for:

await client.send_message(
    chat_id=story.chat.id,
    text="hello",
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_text("hello")
Parameters:
  • text (str) – Text of the message to be sent.

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

  • entities (List of MessageEntity) – List of special entities that appear in message text, which can be specified instead of parse_mode.

  • link_preview_options (LinkPreviewOptions, optional) – Options used for link preview generation for the message.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

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

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

Returns:

On success, the sent Message is returned.

Raises:

RPCError – In case of a Telegram RPC error.

reply_animation(animation: str | BinaryIO, caption: str = '', parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None, has_spoiler: bool = None, duration: int = 0, width: int = 0, height: int = 0, thumb: str | BinaryIO = None, file_name: str = None, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, progress: Callable = None, progress_args: tuple = ()) Message | None

Bound method reply_animation Story.

Use as a shortcut for:

await client.send_animation(
    chat_id=story.chat.id,
    animation=animation,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_animation(animation)
Parameters:
  • animation (str) – Animation to send. Pass a file_id as string to send an animation that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get an animation from the Internet, or pass a file path as string to upload a new animation that exists on your local machine.

  • caption (str, optional) – Animation caption, 0-1024 characters.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

  • has_spoiler (bool, optional) – Pass True if the animation needs to be covered with a spoiler animation.

  • duration (int, optional) – Duration of sent animation in seconds.

  • width (int, optional) – Animation width.

  • height (int, optional) – Animation height.

  • thumb (str | BinaryIO, optional) – Thumbnail of the animation file sent. The thumbnail should be in JPEG format and less than 200 KB in size. A thumbnail’s width and height should not exceed 320 pixels. Thumbnails can’t be reused and can be only uploaded as a new file.

  • file_name (str, optional) – File name of the animation sent. Defaults to file’s path basename.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the sent Message is returned. In case the upload is deliberately stopped with stop_transmission(), None is returned instead.

Raises:

RPCError – In case of a Telegram RPC error.

reply_audio(audio: str | BinaryIO, caption: str = '', parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None, duration: int = 0, performer: str = None, title: str = None, thumb: str | BinaryIO = None, file_name: str = None, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, progress: Callable = None, progress_args: tuple = ()) Message | None

Bound method reply_audio of Story.

Use as a shortcut for:

await client.send_audio(
    chat_id=story.chat.id,
    audio=audio,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_audio(audio)
Parameters:
  • audio (str) – Audio file to send. Pass a file_id as string to send an audio file that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get an audio file from the Internet, or pass a file path as string to upload a new audio file that exists on your local machine.

  • caption (str, optional) – Audio caption, 0-1024 characters.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

  • duration (int, optional) – Duration of the audio in seconds.

  • performer (str, optional) – Performer.

  • title (str, optional) – Track name.

  • thumb (str | BinaryIO, optional) – Thumbnail of the music file album cover. The thumbnail should be in JPEG format and less than 200 KB in size. A thumbnail’s width and height should not exceed 320 pixels. Thumbnails can’t be reused and can be only uploaded as a new file.

  • file_name (str, optional) – File name of the audio sent. Defaults to file’s path basename.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the sent Message is returned. In case the upload is deliberately stopped with stop_transmission(), None is returned instead.

Raises:

RPCError – In case of a Telegram RPC error.

reply_cached_media(file_id: str, caption: str = '', parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None, disable_notification: bool = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None) Message | None

Bound method reply_cached_media of Story.

Use as a shortcut for:

await client.send_cached_media(
    chat_id=story.chat.id,
    file_id=file_id,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_cached_media(file_id)
Parameters:
  • file_id (str) – Media to send. Pass a file_id as string to send a media that exists on the Telegram servers.

  • caption (bool, optional) – Media caption, 0-1024 characters.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

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

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

Returns:

On success, the sent Message is returned.

Raises:

RPCError – In case of a Telegram RPC error.

reply_media_group(media: List[InputMediaPhoto | InputMediaVideo | InputMediaAudio | InputMediaDocument], paid_message_star_count: int = None, disable_notification: bool = None) List[Message]

Bound method reply_media_group of Story.

Use as a shortcut for:

await client.send_media_group(
    chat_id=story.chat.id,
    media=list_of_media,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_media_group(list_of_media)
Parameters:
  • media (list) – A list containing either InputMediaPhoto or InputMediaVideo objects describing photos and videos to be sent, must include 2–10 items.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

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

Returns:

On success, a Messages object is returned containing all the single messages sent.

Raises:

RPCError – In case of a Telegram RPC error.

reply_photo(photo: str | BinaryIO, caption: str = '', parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None, has_spoiler: bool = None, ttl_seconds: int = None, view_once: bool = None, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, progress: Callable = None, progress_args: tuple = ()) Message | None

Bound method reply_photo of Story.

Use as a shortcut for:

await client.send_photo(
    chat_id=story.chat.id,
    photo=photo,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_photo(photo)
Parameters:
  • photo (str) – Photo to send. Pass a file_id as string to send a photo that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get a photo from the Internet, or pass a file path as string to upload a new photo that exists on your local machine.

  • caption (str, optional) – Photo caption, 0-1024 characters.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

  • has_spoiler (bool, optional) – Pass True if the photo needs to be covered with a spoiler animation.

  • ttl_seconds (int, optional) – Self-Destruct Timer. If you set a timer, the photo will self-destruct in ttl_seconds seconds after it was viewed.

  • view_once (bool, optional) – Self-Destruct Timer. If True, the photo will self-destruct after it was viewed.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the sent Message is returned. In case the upload is deliberately stopped with stop_transmission(), None is returned instead.

Raises:

RPCError – In case of a Telegram RPC error.

reply_sticker(sticker: str | BinaryIO, disable_notification: bool = None, paid_message_star_count: int = None, schedule_date: datetime = None, repeat_period: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, progress: Callable = None, progress_args: tuple = ()) Message | None

Bound method reply_sticker of Story.

Use as a shortcut for:

await client.send_sticker(
    chat_id=story.chat.id,
    sticker=sticker,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_sticker(sticker)
Parameters:
  • sticker (str) – Sticker to send. Pass a file_id as string to send a sticker that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get a .webp sticker file from the Internet, or pass a file path as string to upload a new sticker that exists on your local machine.

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

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the sent Message is returned. In case the upload is deliberately stopped with stop_transmission(), None is returned instead.

Raises:

RPCError – In case of a Telegram RPC error.

reply_video(video: str | BinaryIO, caption: str = '', parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None, has_spoiler: bool = None, ttl_seconds: int = None, view_once: bool = None, duration: int = 0, width: int = 0, height: int = 0, video_start_timestamp: int = None, video_cover: str | BinaryIO = None, thumb: str | BinaryIO = None, file_name: str = None, supports_streaming: bool = True, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, no_sound: bool = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, progress: Callable = None, progress_args: tuple = ()) Message | None

Bound method reply_video of Story.

Use as a shortcut for:

await client.send_video(
    chat_id=story.chat.id,
    video=video,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_video(video)
Parameters:
  • video (str) – Video to send. Pass a file_id as string to send a video that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get a video from the Internet, or pass a file path as string to upload a new video that exists on your local machine.

  • caption (str, optional) – Video caption, 0-1024 characters.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

  • has_spoiler (bool, optional) – Pass True if the video needs to be covered with a spoiler animation.

  • ttl_seconds (int, optional) – Self-Destruct Timer. If you set a timer, the video will self-destruct in ttl_seconds seconds after it was viewed.

  • view_once (bool, optional) – Self-Destruct Timer. If True, the photo will self-destruct after it was viewed.

  • duration (int, optional) – Duration of sent video in seconds.

  • width (int, optional) – Video width.

  • height (int, optional) – Video height.

  • video_start_timestamp (int, optional) – Video startpoint, in seconds.

  • video_cover (str | BinaryIO, optional) – Video cover. Pass a file_id as string to attach a photo that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get a photo from the Internet, pass a file path as string to upload a new photo that exists on your local machine, or pass a binary file-like object with its attribute “.name” set for in-memory uploads.

  • thumb (str | BinaryIO, optional) – Thumbnail of the video sent. The thumbnail should be in JPEG format and less than 200 KB in size. A thumbnail’s width and height should not exceed 320 pixels. Thumbnails can’t be reused and can be only uploaded as a new file.

  • file_name (str, optional) – File name of the video sent. Defaults to file’s path basename.

  • supports_streaming (bool, optional) – Pass True, if the uploaded video is suitable for streaming.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • no_sound (bool, optional) – Pass True, if the uploaded video is a video message with no sound. Doesn’t work for external links.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the sent Message is returned. In case the upload is deliberately stopped with stop_transmission(), None is returned instead.

Raises:

RPCError – In case of a Telegram RPC error.

reply_video_note(video_note: str | BinaryIO, duration: int = 0, length: int = 1, thumb: str | BinaryIO = None, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, view_once: bool = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, progress: Callable = None, progress_args: tuple = ()) Message | None

Bound method reply_video_note of Story.

Use as a shortcut for:

await client.send_video_note(
    chat_id=story.chat.id,
    video_note=video_note,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await story.reply_video_note(video_note)
Parameters:
  • video_note (str) – Video note to send. Pass a file_id as string to send a video note that exists on the Telegram servers, or pass a file path as string to upload a new video note that exists on your local machine. Sending video notes by a URL is currently unsupported.

  • duration (int, optional) – Duration of sent video in seconds.

  • length (int, optional) – Video width and height.

  • thumb (str | BinaryIO, optional) – Thumbnail of the video sent. The thumbnail should be in JPEG format and less than 200 KB in size. A thumbnail’s width and height should not exceed 320 pixels. Thumbnails can’t be reused and can be only uploaded as a new file.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • view_once (bool, optional) – Self-Destruct Timer. If True, the video note will self-destruct after it was viewed.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the sent Message is returned. In case the upload is deliberately stopped with stop_transmission(), None is returned instead.

Raises:

RPCError – In case of a Telegram RPC error.

reply_voice(voice: str | BinaryIO, caption: str = '', parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None, duration: int = 0, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, view_once: bool = None, paid_message_star_count: int = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply = None, progress: Callable = None, progress_args: tuple = ()) Message | None

Bound method reply_voice of Story.

Use as a shortcut for:

await client.send_voice(
    chat_id=story.chat.id,
    voice=voice,
    reply_parameters=types.ReplyParameters(
        chat_id=chat_id,
        story_id=story.id
    )
)

Example

await message.reply_voice(voice)
Parameters:
  • voice (str) – Audio file to send. Pass a file_id as string to send an audio that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get an audio from the Internet, or pass a file path as string to upload a new audio that exists on your local machine.

  • caption (str, optional) – Voice message caption, 0-1024 characters.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

  • duration (int, optional) – Duration of the voice message in seconds.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • view_once (bool, optional) – Self-Destruct Timer. If True, the voice note will self-destruct after it was listened.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the sent Message is returned. In case the upload is deliberately stopped with stop_transmission(), None is returned instead.

Raises:

RPCError – In case of a Telegram RPC error.

copy(chat_id: int | str, caption: str | None = None, parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] | None = None, period: int | None = None, media_areas: List[MediaArea] | None = None, privacy: StoriesPrivacyRules | None = None, allowed_users: List[int] | None = None, disallowed_users: List[int] | None = None, protect_content: bool | None = None) Story

Bound method copy of Story.

Use as a shortcut for:

await client.copy_story(
    chat_id=story.chat.id,
    from_chat_id=from_chat_id,
    story_id=story.id
)

Example

await story.copy(chat_id)
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. For your personal stories you can simply use “me” or “self”.

  • caption (str, optional) – New caption for story, 0-1024 characters after entities parsing. If not specified, the original caption is kept. Pass “” (empty string) to remove the caption.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the new caption, which can be specified instead of parse_mode.

  • period (int, optional) – How long the story will posted, in secs. only for premium users.

  • media_areas (List of MediaArea, optional) – List of media areas to add to the story.

  • privacy (StoriesPrivacyRules, optional) – Story privacy. Defaults to PUBLIC

  • allowed_users (List of int, optional) – List of user_id or chat_id of chat users who are allowed to view stories. Note: chat_id available only with SELECTED_USERS. Works with CLOSE_FRIENDS and SELECTED_USERS only

  • disallowed_users (List of int, optional) – List of user_id whos disallow to view the stories. Note: Works with PUBLIC and CONTACTS only

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

Returns:

Story – On success, the copied story is returned.

Raises:

RPCError – In case of a Telegram RPC error.

delete()

Bound method delete of Story.

Use as a shortcut for:

await client.delete_stories(
    story_ids=story.id
)

Example

await story.delete()
Returns:

True on success, False otherwise.

Raises:

RPCError – In case of a Telegram RPC error.

edit_media(media: str | BinaryIO = None) Story

Bound method edit_media of Story.

Use as a shortcut for:

await client.edit_story_media(
    chat_id=story.chat.id,
    story_id=story.id,
    media=media
)

Example

await story.edit_media("new_video.mp4")
Parameters:

media (str | BinaryIO, optional) – New story media. Pass a file_id as string to send a photo that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get a photo from the Internet, pass a file path as string to upload a new photo that exists on your local machine, or pass a binary file-like object with its attribute “.name” set for in-memory uploads.

Returns:

On success, the edited Story is returned.

Raises:

RPCError – In case of a Telegram RPC error.

edit_caption(caption: str, parse_mode: ParseMode | None = None, caption_entities: List[MessageEntity] = None) Story

Bound method edit_caption of Story.

Use as a shortcut for:

await client.edit_story_caption(
    story_id=story.id,
    caption="hello"
)

Example

await story.edit_caption("hello")
Parameters:
  • caption (str) – New caption of the story.

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

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

Returns:

On success, the edited Story is returned.

Raises:

RPCError – In case of a Telegram RPC error.

edit_privacy(privacy: StoriesPrivacyRules = ftmgram.enums.StoriesPrivacyRules.PUBLIC, allowed_users: List[int | str] = None, disallowed_users: List[int | str] = None) Story

Bound method edit_privacy of Story.

Use as a shortcut for:

await client.edit_story_privacy(
    story_id=story.id,
    privacy=enums.StoriesPrivacyRules.PUBLIC
)

Example

await story.edit_privacy(enums.StoriesPrivacyRules.PUBLIC)
Parameters:
  • privacy (StoriesPrivacyRules, optional) – Story privacy. Defaults to PUBLIC.

  • allowed_users (List of int | str, optional) – List of user_id or chat_id of chat users who are allowed to view stories. Note: chat_id available only with SELECTED_USERS. Works with CLOSE_FRIENDS and SELECTED_USERS only

  • disallowed_users (List of int | str, optional) – List of user_id whos disallow to view the stories. Note: Works with PUBLIC and CONTACTS only

Returns:

On success, the edited Story is returned.

Raises:

RPCError – In case of a Telegram RPC error.

react(emoji: int | str = None) bool

Bound method react of Story.

Use as a shortcut for:

await client.send_reaction(
    chat_id=story.chat.id,
    story_id=story.id,
    emoji="🔥"
)

Example

await story.react(emoji="🔥")
Parameters:

emoji (int | str, optional) – Reaction emoji. Pass None as emoji (default) to retract the reaction.

Returns:

bool – On success, True is returned.

Raises:

RPCError – In case of a Telegram RPC error.

forward(chat_id: int | str, message_thread_id: int = None, disable_notification: bool = None, schedule_date: datetime = None, repeat_period: int = None, paid_message_star_count: int = None) Message | None

Bound method forward of Story.

Use as a shortcut for:

await client.forward_story(
    chat_id=chat_id,
    from_chat_id=story.chat.id,
    story_id=story.id
)

Example

await story.forward(chat_id)
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).

  • message_thread_id (int, optional) – Unique identifier of a message thread to which the message belongs. For supergroups only.

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

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

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

Returns:

On success, the forwarded Message is returned.

Raises:

RPCError – In case of a Telegram RPC error.

download(file_name: str = '', in_memory: bool = False, block: bool = True, progress: Callable = None, progress_args: tuple = ()) str | BinaryIO | None

Bound method download of Story.

Use as a shortcut for:

await client.download_media(story)

Example

await story.download()
Parameters:
  • file_name (str, optional) – A custom file_name to be used instead of the one provided by Telegram. By default, all files are downloaded in the downloads folder in your working directory. You can also specify a path for downloading files in a custom location: paths that end with “/” are considered directories. All non-existent folders will be created automatically.

  • in_memory (bool, optional) – Pass True to download the media in-memory. A binary file-like object with its attribute “.name” set will be returned. Defaults to False.

  • block (bool, optional) – Blocks the code execution until the file has been downloaded. Defaults to True.

  • progress (Callable, optional) – Pass a callback function to view the file transmission progress. The function must take (current, total) as positional arguments (look at Other Parameters below for a detailed description) and will be called back each time a new file chunk has been successfully transmitted.

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback function. You can pass anything you need to be available in the progress callback scope; for example, a Message object or a Client instance in order to edit the message with the updated progress status.

Other Parameters:
  • current (int) – The amount of bytes transmitted so far.

  • total (int) – The total size of the file.

  • *args (tuple, optional) – Extra custom arguments as defined in the progress_args parameter. You can either keep *args or add every single extra argument in your function signature.

Returns:

On success, the absolute path of the downloaded file as string is returned, None otherwise.

Raises:
  • RPCError – In case of a Telegram RPC error.

  • ValueError – If the message doesn’t contain any downloadable media

read() List[int]

Bound method read of Story.

Use as a shortcut for:

await client.read_chat_stories(
    chat_id=chat_id,
    max_id=story_id
)

Example

await story.read()
Returns:

List of int – On success, a list of read stories is returned.

view() bool

Bound method view of Story.

Use as a shortcut for:

await client.view_stories(
    chat_id=chat_id,
    story_id=story_id
)

Example

await story.view()
Returns:

True on success, False otherwise.