1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Badiboy 2020-08-21 17:40:56 +03:00
commit 17f48916ad
4 changed files with 29 additions and 6 deletions

View File

@ -1,13 +1,18 @@
#!/usr/bin/env python
from setuptools import setup
from io import open
import re
def read(filename):
with open(filename, encoding='utf-8') as file:
return file.read()
with open('telebot/version.py', 'r', encoding='utf-8') as f: # Credits: LonamiWebs
version = re.search(r"^__version__\s*=\s*'(.*)'.*$",
f.read(), flags=re.MULTILINE).group(1)
setup(name='pyTelegramBotAPI',
version='3.7.2',
version=version,
description='Python Telegram bot api. ',
long_description=read('README.md'),
long_description_content_type="text/markdown",

View File

@ -509,7 +509,7 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa
def send_animation(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None):
parse_mode=None, disable_notification=None, timeout=None, thumb=None):
method_url = r'sendAnimation'
payload = {'chat_id': chat_id}
files = None
@ -531,6 +531,11 @@ def send_animation(token, chat_id, data, duration=None, caption=None, reply_to_m
payload['disable_notification'] = disable_notification
if timeout:
payload['connect-timeout'] = timeout
if thumb:
if not util.is_string(thumb):
files['thumb'] = thumb
else:
payload['thumb'] = thumb
return _make_request(token, method_url, params=payload, files=files, method='post')
@ -561,7 +566,7 @@ def send_voice(token, chat_id, voice, caption=None, duration=None, reply_to_mess
def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None, timeout=None):
disable_notification=None, timeout=None, thumb=None):
method_url = r'sendVideoNote'
payload = {'chat_id': chat_id}
files = None
@ -571,7 +576,7 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m
payload['video_note'] = data
if duration:
payload['duration'] = duration
if length:
if length and (str(length).isdigit() and int(length) <= 639):
payload['length'] = length
else:
payload['length'] = 639 # seems like it is MAX length size
@ -583,6 +588,11 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m
payload['disable_notification'] = disable_notification
if timeout:
payload['connect-timeout'] = timeout
if thumb:
if not util.is_string(thumb):
files['thumb'] = thumb
else:
payload['thumb'] = thumb
return _make_request(token, method_url, params=payload, files=files, method='post')
@ -622,7 +632,7 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non
def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, parse_mode=None,
disable_notification=None, timeout=None, caption=None):
disable_notification=None, timeout=None, caption=None, thumb=None):
method_url = get_method_by_type(data_type)
payload = {'chat_id': chat_id}
files = None
@ -642,6 +652,11 @@ def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_m
payload['connect-timeout'] = timeout
if caption:
payload['caption'] = caption
if thumb:
if not util.is_string(thumb):
files['thumb'] = thumb
else:
payload['thumb'] = thumb
return _make_request(token, method_url, params=payload, files=files, method='post')

3
telebot/version.py Normal file
View File

@ -0,0 +1,3 @@
# Versions should comply with PEP440.
# This line is parsed in setup.py:
__version__ = '3.7.2'