From d528672a3be6246737772bb8dcf3efeb01961456 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 16 Dec 2017 01:16:52 +0100 Subject: [PATCH] Add send_video method --- pyrogram/client/client.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index aa632752..8fedf818 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -620,3 +620,33 @@ class Client: random_id=self.rnd_id() ) ) + + def send_video(self, + chat_id: int or str, + video: str, + duration: int = 0, + width: int = 0, + height: int = 0, + caption: str = "", + disable_notification: bool = None, + reply_to_message_id: int = None): + return self.send( + functions.messages.SendMedia( + peer=self.resolve_peer(chat_id), + media=types.InputMediaUploadedDocument( + mime_type=mimetypes.types_map[".mp4"], + file=self.save_file(video), + caption=caption, + attributes=[ + types.DocumentAttributeVideo( + duration=duration, + w=width, + h=height + ) + ] + ), + silent=disable_notification or None, + reply_to_msg_id=reply_to_message_id, + random_id=self.rnd_id() + ) + )