def write(self):
        animation = types.InputWebDocument(url=self.animation_url,
                                           size=0,
                                           mime_type="image/gif",
                                           attributes=[])

        if self.thumb_url is None:
            thumb = animation
        else:
            thumb = types.InputWebDocument(url=self.thumb_url,
                                           size=0,
                                           mime_type="image/gif",
                                           attributes=[])

        return types.InputBotInlineResult(
            id=self.id,
            type=self.type,
            title=self.title,
            description=self.description,
            thumb=thumb,
            content=animation,
            send_message=(self.input_message_content.write(self.reply_markup)
                          if self.input_message_content else
                          types.InputBotInlineMessageMediaAuto(
                              reply_markup=self.reply_markup.write()
                              if self.reply_markup else None,
                              **(Parser(None)).parse(self.caption,
                                                     self.parse_mode))))
Exemple #2
0
 def write(self):
     return types.InputBotInlineResult(
         id=self.id,
         type="photo",
         send_message=types.InputBotInlineMessageMediaAuto(
             reply_markup=self.reply_markup.write() if self.reply_markup else None,
             **self.style.parse(self.caption)
         ),
         title=self.title,
         description=self.description,
         url=self.photo_url,
         thumb=types.InputWebDocument(
             url=self.thumb_url,
             size=0,
             mime_type="image/jpeg",
             attributes=[
                 types.DocumentAttributeImageSize(
                     w=0,
                     h=0
                 )
             ]
         ),
         content=types.InputWebDocument(
             url=self.thumb_url,
             size=0,
             mime_type="image/jpeg",
             attributes=[
                 types.DocumentAttributeImageSize(
                     w=self.photo_width,
                     h=self.photo_height
                 )
             ]
         )
     )
Exemple #3
0
 def write(self):
     return types.InputBotInlineResult(
         id=self.id,
         type=self.type,
         send_message=self.input_message_content.write(self.reply_markup),
         title=self.title,
         description=self.description,
         url=self.url,
         thumb=types.InputWebDocument(url=self.thumb_url,
                                      size=0,
                                      mime_type="image/jpeg",
                                      attributes=[])
         if self.thumb_url else None)
Exemple #4
0
 async def write(self):
     return types.InputBotInlineResult(
         id=str(self.id),
         type=self.type,
         send_message=await
         self.input_message_content.write(self.reply_markup),
         title=self.title,
         description=self.description,
         url=self.url,
         thumb=types.InputWebDocument(url=self.thumb_url,
                                      size=0,
                                      mime_type="image/jpeg",
                                      attributes=[
                                          types.DocumentAttributeImageSize(
                                              w=self.thumb_width,
                                              h=self.thumb_height)
                                      ]) if self.thumb_url else None)