Source code for hydrogram.raw.functions.messages.export_chat_invite
# Hydrogram - Telegram MTProto API Client Library for Python# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>## This file is part of Hydrogram.## Hydrogram 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.## Hydrogram 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 Hydrogram. If not, see <http://www.gnu.org/licenses/>.fromioimportBytesIOfromhydrogram.raw.core.primitivesimportInt,Long,Int128,Int256,Bool,Bytes,String,Double,Vectorfromhydrogram.raw.coreimportTLObjectfromhydrogramimportrawfromtypingimportList,Optional,Any# # # # # # # # # # # # # # # # # # # # # # # ## !!! WARNING !!! ## This is a generated file! ## All changes made in this file will be lost! ## # # # # # # # # # # # # # # # # # # # # # # #
[docs]classExportChatInvite(TLObject):# type: ignore"""Export an invite link for a chat Details: - Layer: ``181`` - ID: ``A02CE5D5`` Parameters: peer (:obj:`InputPeer <hydrogram.raw.base.InputPeer>`): Chat legacy_revoke_permanent (``bool``, *optional*): Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. request_needed (``bool``, *optional*): Whether admin confirmation is required before admitting each separate user into the chat expire_date (``int`` ``32-bit``, *optional*): Expiration date usage_limit (``int`` ``32-bit``, *optional*): Maximum number of users that can join using this link title (``str``, *optional*): Description of the invite link, visible only to administrators Returns: :obj:`ExportedChatInvite <hydrogram.raw.base.ExportedChatInvite>` """__slots__:List[str]=["peer","legacy_revoke_permanent","request_needed","expire_date","usage_limit","title"]ID=0xa02ce5d5QUALNAME="functions.messages.ExportChatInvite"def__init__(self,*,peer:"raw.base.InputPeer",legacy_revoke_permanent:Optional[bool]=None,request_needed:Optional[bool]=None,expire_date:Optional[int]=None,usage_limit:Optional[int]=None,title:Optional[str]=None)->None:self.peer=peer# InputPeerself.legacy_revoke_permanent=legacy_revoke_permanent# flags.2?trueself.request_needed=request_needed# flags.3?trueself.expire_date=expire_date# flags.0?intself.usage_limit=usage_limit# flags.1?intself.title=title# flags.4?string@staticmethoddefread(b:BytesIO,*args:Any)->"ExportChatInvite":flags=Int.read(b)legacy_revoke_permanent=Trueifflags&(1<<2)elseFalserequest_needed=Trueifflags&(1<<3)elseFalsepeer=TLObject.read(b)expire_date=Int.read(b)ifflags&(1<<0)elseNoneusage_limit=Int.read(b)ifflags&(1<<1)elseNonetitle=String.read(b)ifflags&(1<<4)elseNonereturnExportChatInvite(peer=peer,legacy_revoke_permanent=legacy_revoke_permanent,request_needed=request_needed,expire_date=expire_date,usage_limit=usage_limit,title=title)defwrite(self,*args)->bytes:b=BytesIO()b.write(Int(self.ID,False))flags=0flags|=(1<<2)ifself.legacy_revoke_permanentelse0flags|=(1<<3)ifself.request_neededelse0flags|=(1<<0)ifself.expire_dateisnotNoneelse0flags|=(1<<1)ifself.usage_limitisnotNoneelse0flags|=(1<<4)ifself.titleisnotNoneelse0b.write(Int(flags))b.write(self.peer.write())ifself.expire_dateisnotNone:b.write(Int(self.expire_date))ifself.usage_limitisnotNone:b.write(Int(self.usage_limit))ifself.titleisnotNone:b.write(String(self.title))returnb.getvalue()