mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 23:27:49 +01:00
Fix stuff as per @tsnoam's comments
This commit is contained in:
parent
99ecac5649
commit
a7044562af
3 changed files with 10 additions and 29 deletions
|
@ -687,9 +687,9 @@ class Bot(TelegramObject):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
chat_id (int|str): Unique identifier for the message recipient - Chat id.
|
chat_id (int|str): Unique identifier for the message recipient - Chat id.
|
||||||
voice: Video note to send. Pass a file_id as String to send a video note that exists
|
video_note (InputFile|str): Video note to send. Pass a file_id as String to send a
|
||||||
on the Telegram servers (recommended) or upload a new video. Sending video notes
|
video note that exists on the Telegram servers (recommended) or upload a new video.
|
||||||
by a URL is currently unsupported
|
Sending video notes by a URL is currently unsupported
|
||||||
duration (Optional[int]): Duration of sent audio in seconds.
|
duration (Optional[int]): Duration of sent audio in seconds.
|
||||||
length (Optional[int]): Video width and height
|
length (Optional[int]): Video width and height
|
||||||
disable_notification (Optional[bool]): Sends the message silently. iOS users will not
|
disable_notification (Optional[bool]): Sends the message silently. iOS users will not
|
||||||
|
|
|
@ -46,30 +46,11 @@ class InputFile(object):
|
||||||
self.data = data
|
self.data = data
|
||||||
self.boundary = choose_boundary()
|
self.boundary = choose_boundary()
|
||||||
|
|
||||||
if 'audio' in data:
|
for t in FILE_TYPES:
|
||||||
self.input_name = 'audio'
|
if t in data:
|
||||||
self.input_file = data.pop('audio')
|
self.input_name = t
|
||||||
elif 'document' in data:
|
self.input_file = data.pop(t)
|
||||||
self.input_name = 'document'
|
break
|
||||||
self.input_file = data.pop('document')
|
|
||||||
elif 'photo' in data:
|
|
||||||
self.input_name = 'photo'
|
|
||||||
self.input_file = data.pop('photo')
|
|
||||||
elif 'sticker' in data:
|
|
||||||
self.input_name = 'sticker'
|
|
||||||
self.input_file = data.pop('sticker')
|
|
||||||
elif 'video' in data:
|
|
||||||
self.input_name = 'video'
|
|
||||||
self.input_file = data.pop('video')
|
|
||||||
elif 'voice' in data:
|
|
||||||
self.input_name = 'voice'
|
|
||||||
self.input_file = data.pop('voice')
|
|
||||||
elif 'certificate' in data:
|
|
||||||
self.input_name = 'certificate'
|
|
||||||
self.input_file = data.pop('certificate')
|
|
||||||
elif 'video_note' in data:
|
|
||||||
self.input_name = 'video_note'
|
|
||||||
self.input_file = data.pop('video_note')
|
|
||||||
else:
|
else:
|
||||||
raise TelegramError('Unknown inputfile type')
|
raise TelegramError('Unknown inputfile type')
|
||||||
|
|
||||||
|
@ -121,7 +102,7 @@ class InputFile(object):
|
||||||
form_boundary, 'Content-Disposition: form-data; name="%s"' % name, '', str(value)
|
form_boundary, 'Content-Disposition: form-data; name="%s"' % name, '', str(value)
|
||||||
])
|
])
|
||||||
|
|
||||||
# Add input_file to upload
|
# Add input_file to upload
|
||||||
form.extend([
|
form.extend([
|
||||||
form_boundary, 'Content-Disposition: form-data; name="%s"; filename="%s"' %
|
form_boundary, 'Content-Disposition: form-data; name="%s"; filename="%s"' %
|
||||||
(self.input_name,
|
(self.input_name,
|
||||||
|
|
|
@ -129,7 +129,6 @@ class Message(TelegramObject):
|
||||||
sticker=None,
|
sticker=None,
|
||||||
video=None,
|
video=None,
|
||||||
voice=None,
|
voice=None,
|
||||||
video_note=None,
|
|
||||||
caption=None,
|
caption=None,
|
||||||
contact=None,
|
contact=None,
|
||||||
location=None,
|
location=None,
|
||||||
|
@ -147,6 +146,7 @@ class Message(TelegramObject):
|
||||||
pinned_message=None,
|
pinned_message=None,
|
||||||
forward_from_message_id=None,
|
forward_from_message_id=None,
|
||||||
bot=None,
|
bot=None,
|
||||||
|
video_note=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
# Required
|
# Required
|
||||||
self.message_id = int(message_id)
|
self.message_id = int(message_id)
|
||||||
|
|
Loading…
Reference in a new issue