mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-17 10:36:37 +00:00
Add customizable 'mime_type' for send_file
This commit is contained in:
parent
663a1808a1
commit
4c63a376a4
@ -117,6 +117,7 @@ class UploadMethods:
|
|||||||
*,
|
*,
|
||||||
caption: typing.Union[str, typing.Sequence[str]] = None,
|
caption: typing.Union[str, typing.Sequence[str]] = None,
|
||||||
force_document: bool = False,
|
force_document: bool = False,
|
||||||
|
mime_type: str = None,
|
||||||
file_size: int = None,
|
file_size: int = None,
|
||||||
clear_draft: bool = False,
|
clear_draft: bool = False,
|
||||||
progress_callback: 'hints.ProgressCallback' = None,
|
progress_callback: 'hints.ProgressCallback' = None,
|
||||||
@ -209,6 +210,13 @@ class UploadMethods:
|
|||||||
the extension of an image file or a video file, it will be
|
the extension of an image file or a video file, it will be
|
||||||
sent as such. Otherwise always as a document.
|
sent as such. Otherwise always as a document.
|
||||||
|
|
||||||
|
mime_type (`str`, optional):
|
||||||
|
Custom mime type to use for the file to be sent (for example,
|
||||||
|
``audio/mpeg``, ``audio/x-vorbis+ogg``, etc.).
|
||||||
|
It can change the type of files displayed.
|
||||||
|
If not set to any value, the mime type will be determined
|
||||||
|
automatically based on the file's extension.
|
||||||
|
|
||||||
file_size (`int`, optional):
|
file_size (`int`, optional):
|
||||||
The size of the file to be uploaded if it needs to be uploaded,
|
The size of the file to be uploaded if it needs to be uploaded,
|
||||||
which will be determined automatically if not specified.
|
which will be determined automatically if not specified.
|
||||||
@ -450,6 +458,7 @@ class UploadMethods:
|
|||||||
|
|
||||||
file_handle, media, image = await self._file_to_media(
|
file_handle, media, image = await self._file_to_media(
|
||||||
file, force_document=force_document,
|
file, force_document=force_document,
|
||||||
|
mime_type=mime_type,
|
||||||
file_size=file_size,
|
file_size=file_size,
|
||||||
progress_callback=progress_callback,
|
progress_callback=progress_callback,
|
||||||
attributes=attributes, allow_cache=allow_cache, thumb=thumb,
|
attributes=attributes, allow_cache=allow_cache, thumb=thumb,
|
||||||
|
Loading…
Reference in New Issue
Block a user