polygraph

Отправка картинок по URL vkBottle

Sep 21st, 2022
1,828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. async def get_data_from_link(api: API, link: str) -> BytesIO:
  2.         return BytesIO(await api.http_client.request_content(link, "GET"))
  3.  
  4. @bot.on.private_message()
  5. async def photo(message: Message):
  6.     bytePicture =  await get_data_from_link(bot.api, link="https://proprikol.ru/wp-content/uploads/2020/04/krasivye-kartinki-vysokogo-razresheniya-3.jpg")
  7.     attachment = await PhotoMessageUploader(bot.api, generate_attachment_strings=True).upload(bytePicture)
  8.     await message.answer("Моя картинка", attachment=attachment)
Advertisement
Add Comment
Please, Sign In to add comment