From c5ee2fe4b23a49f70a77705c392b777db24b73f6 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Tue, 30 May 2017 23:05:33 +0300 Subject: [PATCH] Add send video note --- aiogram/api.py | 2 +- aiogram/bot.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/aiogram/api.py b/aiogram/api.py index 19849d49..6935b1f9 100644 --- a/aiogram/api.py +++ b/aiogram/api.py @@ -97,7 +97,7 @@ class ApiMethods: SEND_STICKER = 'sendSticker' SEND_VIDEO = 'sendVideo' SEND_VOICE = 'sendVoice' - SEND_VIDEO_NOTE = 'sendVideoNote' # TODO + SEND_VIDEO_NOTE = 'sendVideoNote' SEND_LOCATION = 'sendLocation' # TODO SEND_VENUE = 'sendVenue' # TODO SEND_CONTACT = 'sendContact' # TODO diff --git a/aiogram/bot.py b/aiogram/bot.py index 3902a3f1..b8db4bf9 100644 --- a/aiogram/bot.py +++ b/aiogram/bot.py @@ -206,3 +206,15 @@ class AIOGramBot: payload = generate_payload(**locals(), exclude=[_message_type]) return await self._send_file(_message_type, voice, payload) + + async def send_video_note(self, chat_id, video_note, duration=None, length=None, disable_notification=None, + reply_to_message_id=None, reply_markup=None) -> Message: + _message_type = 'video_note' + if reply_markup and hasattr(reply_markup, 'to_json'): + reply_markup = json.dumps(reply_markup.to_json()) + + if hasattr(reply_to_message_id, 'message_id'): + reply_to_message_id = reply_to_message_id.message_id + + payload = generate_payload(**locals(), exclude=[_message_type]) + return await self._send_file(_message_type, video_note, payload)