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

Merge pull request #1204 from floydya/file-name-patch

Allows to set visible document file_name on send.
This commit is contained in:
Badiboy
2021-06-29 13:27:44 +03:00
committed by GitHub
3 changed files with 19 additions and 4 deletions

View File

@@ -806,12 +806,15 @@ 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, thumb=None, caption_entities=None,
allow_sending_without_reply=None, disable_content_type_detection=None):
allow_sending_without_reply=None, disable_content_type_detection=None, file_name=None):
method_url = get_method_by_type(data_type)
payload = {'chat_id': chat_id}
files = None
if not util.is_string(data):
files = {data_type: data}
file_data = data
if file_name is not None:
file_data = (file_name, data)
files = {data_type: file_data}
else:
payload[data_type] = data
if reply_to_message_id: