X Tutup
Skip to content

Commit 2746ab7

Browse files
committed
Add sendVideoNote to Bot
1 parent ae39c90 commit 2746ab7

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

telegram/bot.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,66 @@ def send_voice(self,
671671
timeout=timeout,
672672
**kwargs)
673673

674+
@log
675+
def send_video_note(self,
676+
chat_id,
677+
video_note,
678+
duration=None,
679+
length=None,
680+
disable_notification=False,
681+
reply_to_message_id=None,
682+
reply_markup=None,
683+
timeout=20.,
684+
**kwargs):
685+
"""As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute
686+
long. Use this method to send video messages
687+
688+
Args:
689+
chat_id (int|str): Unique identifier for the message recipient - Chat id.
690+
voice: Video note to send. Pass a file_id as String to send a video note that exists
691+
on the Telegram servers (recommended) or upload a new video. Sending video notes
692+
by a URL is currently unsupported
693+
duration (Optional[int]): Duration of sent audio in seconds.
694+
length (Optional[int]): Video width and height
695+
disable_notification (Optional[bool]): Sends the message silently. iOS users will not
696+
receive a notification, Android users will receive a notification with no sound.
697+
reply_to_message_id (Optional[int]): If the message is a reply, ID of the original
698+
message.
699+
reply_markup (Optional[:class:`telegram.ReplyMarkup`]): Additional interface options. A
700+
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
701+
to remove reply keyboard or to force a reply from the user.
702+
timeout (Optional[int|float]): Send file timeout (default: 20 seconds).
703+
**kwargs (dict): Arbitrary keyword arguments.
704+
705+
Returns:
706+
:class:`telegram.Message`: On success, instance representing the message posted.
707+
708+
Raises:
709+
:class:`telegram.TelegramError`
710+
711+
"""
712+
url = '{0}/sendVideoNote'.format(self.base_url)
713+
714+
data = {'chat_id': chat_id, 'video_note': video_note}
715+
716+
if duration:
717+
data['duration'] = duration
718+
if length:
719+
data['length'] = length
720+
721+
return self._message_wrapper(
722+
url,
723+
data,
724+
chat_id=chat_id,
725+
video_note=video_note,
726+
duration=duration,
727+
length=length,
728+
disable_notification=disable_notification,
729+
reply_to_message_id=reply_to_message_id,
730+
reply_markup=reply_markup,
731+
timeout=timeout,
732+
**kwargs)
733+
674734
@log
675735
@message
676736
def send_location(self,
@@ -1787,6 +1847,7 @@ def __reduce__(self):
17871847
sendSticker = send_sticker
17881848
sendVideo = send_video
17891849
sendVoice = send_voice
1850+
sendVideoNote = send_video_note
17901851
sendLocation = send_location
17911852
sendVenue = send_venue
17921853
sendContact = send_contact

0 commit comments

Comments
 (0)
X Tutup