Fix stuff as per @tsnoam's comments

This commit is contained in:
Jacob Bom 2017-05-25 14:13:35 +02:00
parent 99ecac5649
commit a7044562af
3 changed files with 10 additions and 29 deletions

View file

@ -687,9 +687,9 @@ class Bot(TelegramObject):
Args:
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
on the Telegram servers (recommended) or upload a new video. Sending video notes
by a URL is currently unsupported
video_note (InputFile|str): Video note to send. Pass a file_id as String to send a
video note that exists on the Telegram servers (recommended) or upload a new video.
Sending video notes by a URL is currently unsupported
duration (Optional[int]): Duration of sent audio in seconds.
length (Optional[int]): Video width and height
disable_notification (Optional[bool]): Sends the message silently. iOS users will not

View file

@ -46,30 +46,11 @@ class InputFile(object):
self.data = data
self.boundary = choose_boundary()
if 'audio' in data:
self.input_name = 'audio'
self.input_file = data.pop('audio')
elif 'document' in data:
self.input_name = 'document'
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')
for t in FILE_TYPES:
if t in data:
self.input_name = t
self.input_file = data.pop(t)
break
else:
raise TelegramError('Unknown inputfile type')
@ -121,7 +102,7 @@ class InputFile(object):
form_boundary, 'Content-Disposition: form-data; name="%s"' % name, '', str(value)
])
# Add input_file to upload
# Add input_file to upload
form.extend([
form_boundary, 'Content-Disposition: form-data; name="%s"; filename="%s"' %
(self.input_name,

View file

@ -129,7 +129,6 @@ class Message(TelegramObject):
sticker=None,
video=None,
voice=None,
video_note=None,
caption=None,
contact=None,
location=None,
@ -147,6 +146,7 @@ class Message(TelegramObject):
pinned_message=None,
forward_from_message_id=None,
bot=None,
video_note=None,
**kwargs):
# Required
self.message_id = int(message_id)