Skip to content

Remove Union for thumbnail in methods and types #1372

Closed
@Desiders

Description

@Desiders

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions