async def write(self): photo = raw.types.InputWebDocument(url=self.photo_url, size=0, mime_type="image/jpeg", attributes=[]) if self.thumb_url is None: thumb = photo else: thumb = raw.types.InputWebDocument(url=self.thumb_url, size=0, mime_type="image/jpeg", attributes=[]) return raw.types.InputBotInlineResult( id=self.id, type=self.type, title=self.title, description=self.description, thumb=thumb, content=photo, send_message=(await self.input_message_content.write( self.reply_markup) if self.input_message_content else raw.types.InputBotInlineMessageMediaAuto( reply_markup=self.reply_markup.write() if self.reply_markup else None, **await (Parser(None)).parse( self.caption, self.parse_mode))))
async def write(self): audio = raw.types.InputWebDocument( url=self.audio_url, size=0, mime_type=self.mime_type, attributes=[raw.types.DocumentAttributeAudio( duration=self.duration, voice=self.voice, title=self.title, performer=self.performer, # waveform=idk wtf is that... )], ) return raw.types.InputBotInlineResult( id=self.id, type=self.type, title=self.title, description=self.description, thumb=raw.types.InputWebDocument( url=self.thumb_url, size=0, mime_type="image/jpeg", attributes=[] ) if self.thumb_url else None, content=audio, send_message=( self.input_message_content.write(self.reply_markup) if self.input_message_content else raw.types.InputBotInlineMessageMediaAuto( reply_markup=self.reply_markup.write() if self.reply_markup else None, **await(Parser(None)).parse(self.caption, self.parse_mode) ) ) )
async def write(self, client: "pyrogram.Client"): voice = types.InputWebDocument( url=self.voice_url, size=0, mime_type="audio/ogg", attributes=[] ) if self.thumb_url is None: thumb = None else: thumb = types.InputWebDocument( url=self.thumb_url, size=0, mime_type="image/jpeg", attributes=[] ) return types.InputBotInlineResult( id=self.id, type=self.type, title=self.title, description=self.description, thumb=thumb, content=voice, send_message=( await self.input_message_content.write(client, self.reply_markup) if self.input_message_content else types.InputBotInlineMessageMediaAuto( reply_markup=await self.reply_markup.write(client) if self.reply_markup else None, **await(Parser(None)).parse(self.caption, self.parse_mode) ) ) )
def __init__(self): try: asyncio.get_event_loop() except RuntimeError: # This happens when creating Client instances inside different threads that don't have an event loop. # Set the main event loop in this thread. asyncio.set_event_loop(pyrogram.main_event_loop) self.session_name = None self.api_id = None self.api_hash = None self.app_version = None self.device_model = None self.system_version = None self.lang_code = None self.ipv6 = None self.proxy = None self.test_mode = None self.bot_token = None self.phone_number = None self.phone_code = None self.password = None self.force_sms = None self.workers = None self.workdir = None self.config_file = None self.plugins = None self.parse_mode = None self.no_updates = None self.takeout = None self.sleep_threshold = None self.executor = None self.storage = None self.rnd_id = MsgId self.parser = Parser(self) self.parse_mode = "combined" self.session = None self.media_sessions = {} self.media_sessions_lock = asyncio.Lock() self.is_connected = None self.is_initialized = None self.no_updates = None self.takeout_id = None self.dispatcher = None self.disconnect_handler = None self.loop = None self.login_by_qr_code = False
def __init__(self): self.session_name = None self.api_id = None self.api_hash = None self.app_version = None self.device_model = None self.system_version = None self.lang_code = None self.ipv6 = None self.proxy = None self.test_mode = None self.bot_token = None self.phone_number = None self.phone_code = None self.password = None self.force_sms = None self.workers = None self.workdir = None self.config_file = None self.plugins = None self.parse_mode = None self.no_updates = None self.takeout = None self.sleep_threshold = None self.executor = None self.storage = None self.rnd_id = MsgId self.parser = Parser(self) self.parse_mode = "combined" self.session = None self.media_sessions = {} self.media_sessions_lock = asyncio.Lock() self.is_connected = None self.is_initialized = None self.no_updates = None self.takeout_id = None self.dispatcher = None self.disconnect_handler = None self.loop = None
async def write(self): photo = utils.get_input_file_from_file_id(self.file_id, self.file_ref, 2) return raw.types.InputBotInlineResultPhoto( id=self.id, type=self.type, photo=photo, send_message=(await self.input_message_content.write( self.reply_markup) if self.input_message_content else raw.types.InputBotInlineMessageMediaAuto( reply_markup=self.reply_markup.write() if self.reply_markup else None, **await (Parser(None)).parse( self.caption, self.parse_mode))))
async def write(self): document = utils.get_input_file_from_file_id(self.file_id, self.file_ref) return raw.types.InputBotInlineResultDocument( id=self.id, type=self.type, title=self.title, description=self.description, document=document, send_message=(await self.input_message_content.write( self.reply_markup) if self.input_message_content else raw.types.InputBotInlineMessageMediaAuto( reply_markup=self.reply_markup.write() if self.reply_markup else None, **await (Parser(None)).parse( self.caption, self.parse_mode))))
async def write(self, reply_markup): return raw.types.InputBotInlineMessageText( no_webpage=self.disable_web_page_preview or None, reply_markup=reply_markup.write() if reply_markup else None, **await(Parser(None)).parse(self.message_text, self.parse_mode) )