Skip to content

Commit

Permalink
added method send_image for bot.
Browse files Browse the repository at this point in the history
  • Loading branch information
dotX12 committed Feb 11, 2022
1 parent d04e17a commit 36c4cbd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions waio/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 36c4cbd

Please sign in to comment.