From 36c4cbda2529452f020de675dbae9d669129cb86 Mon Sep 17 00:00:00 2001 From: dotX12 Date: Fri, 11 Feb 2022 07:56:41 +0300 Subject: [PATCH] added method send_image for bot. --- waio/bot.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/waio/bot.py b/waio/bot.py index cd73e62..e140647 100644 --- a/waio/bot.py +++ b/waio/bot.py @@ -12,6 +12,7 @@ from waio.labeler import BotLabeler from waio.middleware import MiddlewareResponse from waio.models.enums import GupshupMethods +from waio.models.image import ImageModel from waio.models.text import MessageText from waio.states.context import FSMContext from waio.storage.redis import RedisStorage @@ -46,6 +47,16 @@ async def send_message(self, receiver: int, message: str): msg = MessageText(text=message) return await self._base_request(receiver=receiver, data=msg) + async def send_image( + self, + receiver: int, + original_url: str, + preview_url: Optional[str] = None, + caption: Optional[str] = None, + ): + image = ImageModel(original_url=original_url, preview_url=preview_url, caption=caption) + return await self._base_request(receiver=receiver, data=image) + async def send_list(self, receiver: int, keyboard: ListMessage): return await self._base_request(receiver=receiver, data=keyboard)