From a5d1b7f480af8fe91ef3831ddaa4ad6804f4d164 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 14 Dec 2017 09:44:51 +0100 Subject: [PATCH] Add send_photo method --- pyrogram/client/client.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 82728477..840714b7 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -542,3 +542,24 @@ class Client: ) finally: session.stop() + + def send_photo(self, + chat_id: int or str, + photo: str, + caption: str = "", + ttl_seconds: int = None, + disable_notification: bool = None, + reply_to_message_id: int = None): + return self.send( + functions.messages.SendMedia( + peer=self.resolve_peer(chat_id), + media=types.InputMediaUploadedPhoto( + file=self.save_file(photo), + caption=caption, + ttl_seconds=ttl_seconds + ), + silent=disable_notification or None, + reply_to_msg_id=reply_to_message_id, + random_id=self.rnd_id() + ) + )