aiogram version
3.x
Problem
Documentation say Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
So using Union[str, ...] have meaning only in Bot API documentation context, because aiogram for this use InputFile that after serialization turns into string that related to multipart.
Using Union[InputFile, str] can discourage, because usually it means that instead of InputFile can be used url or file_id, but not in this context.
Possible solution
Change Optional[Union[InputFile, str]] and Union[InputFile, str] to Optional[InputFile] and InputFile.
Affected types:
InputMediaVideo
InputMediaAnimation
InputMediaAudio
InputMediaDocument
Affected methods:
sendAudio
sendDocument
sendVideo
sendAnimation
sendVideoNote
Alternatives
No response
Code example
No response
Additional information
I can also refer to the Aliaksei Levin' message in TDLib chat about thumbnail and correct string values for it: https://t.me/tdlibchat/21119
aiogram version
3.x
Problem
Documentation say
Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.So using
Union[str, ...]have meaning only in Bot API documentation context, becauseaiogramfor this useInputFilethat after serialization turns into string that related tomultipart.Using
Union[InputFile, str]can discourage, because usually it means that instead ofInputFilecan be usedurlorfile_id, but not in this context.Possible solution
Change
Optional[Union[InputFile, str]]andUnion[InputFile, str]toOptional[InputFile]andInputFile.Affected types:
InputMediaVideoInputMediaAnimationInputMediaAudioInputMediaDocumentAffected methods:
sendAudiosendDocumentsendVideosendAnimationsendVideoNoteAlternatives
No response
Code example
No response
Additional information
I can also refer to the Aliaksei Levin' message in
TDLib chatabout thumbnail and correct string values for it: https://t.me/tdlibchat/21119