Source code for pyrogram.raw.functions.stories.start_live

#  Pyrogram - Telegram MTProto API Client Library for Python
#  Copyright (C) 2017-present Dan <https://github.com/delivrance>
#
#  This file is part of Pyrogram.
#
#  Pyrogram is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as published
#  by the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  Pyrogram is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with Pyrogram.  If not, see <http://www.gnu.org/licenses/>.

from io import BytesIO

from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
from pyrogram.raw.core import TLObject
from pyrogram import raw
from typing import List, Optional, Any

# # # # # # # # # # # # # # # # # # # # # # # #
#               !!! WARNING !!!               #
#          This is a generated file!          #
# All changes made in this file will be lost! #
# # # # # # # # # # # # # # # # # # # # # # # #


[docs] class StartLive(TLObject): # type: ignore """Start a live story, optionally using RTMP livestream mode, see `here » <https://core.telegram.org/api/group-calls#live-stories>`_ for the full flow. .. include:: /_includes/usable-by/users.rst Details: - Layer: ``229`` - ID: ``D069CCDE`` Parameters: peer (:obj:`InputPeer <pyrogram.raw.base.InputPeer>`): User, supergroup or channel that will own the live story; basic groups cannot post live stories privacy_rules (List of :obj:`InputPrivacyRule <pyrogram.raw.base.InputPrivacyRule>`): Privacy rules defining who can view the live story random_id (``int`` ``64-bit``): Client-generated random ID used to prevent duplicate live stories. See `here » <https://core.telegram.org/api/updates#updatemessageid-updates>`_ for more info on random ID deduplication and updateMessageID mapping. pinned (``bool``, *optional*): Whether to pin the live story on the peer's profile noforwards (``bool``, *optional*): Whether viewers must be prevented from forwarding or saving the live story rtmp_stream (``bool``, *optional*): Create the live story in `RTMP livestream mode » <https://core.telegram.org/api/group-calls#stream-mode>`_, where one external streamer publishes all audio and video caption (``str``, *optional*): Live story caption entities (List of :obj:`MessageEntity <pyrogram.raw.base.MessageEntity>`, *optional*): `Message entities for styled text <https://core.telegram.org/api/entities>`_ messages_enabled (``bool``, *optional*): Whether the `in-call message overlay » <https://core.telegram.org/api/group-calls#in-call-messages>`_ should be enabled send_paid_messages_stars (``int`` ``64-bit``, *optional*): Minimum Telegram Stars donation required from users other than the live story owner for each comment; the owner may always comment without donating, and ``0`` allows free comments for everyone Returns: :obj:`Updates <pyrogram.raw.base.Updates>` """ __slots__: List[str] = ["peer", "privacy_rules", "random_id", "pinned", "noforwards", "rtmp_stream", "caption", "entities", "messages_enabled", "send_paid_messages_stars"] ID = 0xd069ccde QUALNAME = "functions.stories.StartLive" def __init__(self, *, peer: "raw.base.InputPeer", privacy_rules: List["raw.base.InputPrivacyRule"], random_id: int, pinned: Optional[bool] = None, noforwards: Optional[bool] = None, rtmp_stream: Optional[bool] = None, caption: Optional[str] = None, entities: Optional[List["raw.base.MessageEntity"]] = None, messages_enabled: Optional[bool] = None, send_paid_messages_stars: Optional[int] = None) -> None: self.peer = peer # InputPeer self.privacy_rules = privacy_rules # Vector<InputPrivacyRule> self.random_id = random_id # long self.pinned = pinned # flags.2?true self.noforwards = noforwards # flags.4?true self.rtmp_stream = rtmp_stream # flags.5?true self.caption = caption # flags.0?string self.entities = entities # flags.1?Vector<MessageEntity> self.messages_enabled = messages_enabled # flags.6?Bool self.send_paid_messages_stars = send_paid_messages_stars # flags.7?long @staticmethod def read(b: BytesIO, *args: Any) -> "StartLive": flags = Int.read(b) pinned = True if flags & (1 << 2) else False noforwards = True if flags & (1 << 4) else False rtmp_stream = True if flags & (1 << 5) else False peer = TLObject.read(b) caption = String.read(b) if flags & (1 << 0) else None entities = TLObject.read(b) if flags & (1 << 1) else [] privacy_rules = TLObject.read(b) random_id = Long.read(b) messages_enabled = Bool.read(b) if flags & (1 << 6) else None send_paid_messages_stars = Long.read(b) if flags & (1 << 7) else None return StartLive(peer=peer, privacy_rules=privacy_rules, random_id=random_id, pinned=pinned, noforwards=noforwards, rtmp_stream=rtmp_stream, caption=caption, entities=entities, messages_enabled=messages_enabled, send_paid_messages_stars=send_paid_messages_stars) def write(self, *args) -> bytes: b = BytesIO() b.write(Int(self.ID, False)) flags = 0 flags |= (1 << 2) if self.pinned else 0 flags |= (1 << 4) if self.noforwards else 0 flags |= (1 << 5) if self.rtmp_stream else 0 flags |= (1 << 0) if self.caption is not None else 0 flags |= (1 << 1) if self.entities else 0 flags |= (1 << 6) if self.messages_enabled is not None else 0 flags |= (1 << 7) if self.send_paid_messages_stars is not None else 0 b.write(Int(flags)) b.write(self.peer.write()) if self.caption is not None: b.write(String(self.caption)) if self.entities: b.write(Vector(self.entities)) b.write(Vector(self.privacy_rules)) b.write(Long(self.random_id)) if self.messages_enabled is not None: b.write(Bool(self.messages_enabled)) if self.send_paid_messages_stars is not None: b.write(Long(self.send_paid_messages_stars)) return b.getvalue()