Source code for hydrogram.raw.functions.messages.set_bot_callback_answer
# 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]classSetBotCallbackAnswer(TLObject):# type: ignore"""Set the callback answer to a user button press (bots only) Details: - Layer: ``181`` - ID: ``D58F130A`` Parameters: query_id (``int`` ``64-bit``): Query ID cache_time (``int`` ``32-bit``): Cache validity alert (``bool``, *optional*): Whether to show the message as a popup instead of a toast notification message (``str``, *optional*): Popup to show url (``str``, *optional*): URL to open Returns: ``bool`` """__slots__:List[str]=["query_id","cache_time","alert","message","url"]ID=0xd58f130aQUALNAME="functions.messages.SetBotCallbackAnswer"def__init__(self,*,query_id:int,cache_time:int,alert:Optional[bool]=None,message:Optional[str]=None,url:Optional[str]=None)->None:self.query_id=query_id# longself.cache_time=cache_time# intself.alert=alert# flags.1?trueself.message=message# flags.0?stringself.url=url# flags.2?string@staticmethoddefread(b:BytesIO,*args:Any)->"SetBotCallbackAnswer":flags=Int.read(b)alert=Trueifflags&(1<<1)elseFalsequery_id=Long.read(b)message=String.read(b)ifflags&(1<<0)elseNoneurl=String.read(b)ifflags&(1<<2)elseNonecache_time=Int.read(b)returnSetBotCallbackAnswer(query_id=query_id,cache_time=cache_time,alert=alert,message=message,url=url)defwrite(self,*args)->bytes:b=BytesIO()b.write(Int(self.ID,False))flags=0flags|=(1<<1)ifself.alertelse0flags|=(1<<0)ifself.messageisnotNoneelse0flags|=(1<<2)ifself.urlisnotNoneelse0b.write(Int(flags))b.write(Long(self.query_id))ifself.messageisnotNone:b.write(String(self.message))ifself.urlisnotNone:b.write(String(self.url))b.write(Int(self.cache_time))returnb.getvalue()