Add send video

This commit is contained in:
Alex Root Junior 2017-05-30 22:53:36 +03:00
parent f399232ea6
commit 321bd68b5a
2 changed files with 15 additions and 3 deletions

View file

@ -95,7 +95,7 @@ class ApiMethods:
SEND_AUDIO = 'sendAudio'
SEND_DOCUMENT = 'sendDocument'
SEND_STICKER = 'sendSticker'
SEND_VIDEO = 'sendVideo' # TODO
SEND_VIDEO = 'sendVideo'
SEND_VOICE = 'sendVoice' # TODO
SEND_VIDEO_NOTE = 'sendVideoNote' # TODO
SEND_LOCATION = 'sendLocation' # TODO

View file

@ -168,7 +168,7 @@ class AIOGramBot:
if hasattr(reply_to_message_id, 'message_id'):
reply_to_message_id = reply_to_message_id.message_id
payload = generate_payload(**locals(), exclude=['document'])
payload = generate_payload(**locals(), exclude=[_METHOD])
return await self._send_file(_METHOD, document, payload)
async def send_sticker(self, chat_id, sticker, disable_notification=None, reply_to_message_id=None,
@ -180,5 +180,17 @@ class AIOGramBot:
if hasattr(reply_to_message_id, 'message_id'):
reply_to_message_id = reply_to_message_id.message_id
payload = generate_payload(**locals(), exclude=['sticker'])
payload = generate_payload(**locals(), exclude=[_METHOD])
return await self._send_file(_METHOD, sticker, payload)
async def send_video(self, chat_id, video, duration=None, width=None, height=None, caption=None,
disable_notification=None, reply_to_message_id=None, reply_markup=None) -> Message:
_METHOD = 'video'
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=['video'])
return await self._send_file(_METHOD, video, payload)