mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Allow to send thumbs
This commit is contained in:
parent
dd0ee7124b
commit
5d1c54aa17
1 changed files with 6 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import abc
|
||||
import io
|
||||
import secrets
|
||||
from typing import TYPE_CHECKING, Any, Dict, Generic, Optional, Type, TypeVar, Union
|
||||
|
||||
from pydantic import BaseConfig, BaseModel, Extra
|
||||
|
|
@ -54,7 +55,11 @@ class TelegramMethod(abc.ABC, BaseModel, Generic[T]):
|
|||
return Response[self.__returning__](**data) # type: ignore
|
||||
|
||||
def prepare_file(self, name: str, value: Any, data: Dict[str, Any], files: Dict[str, Any]):
|
||||
if isinstance(value, InputFile):
|
||||
if name == "thumb":
|
||||
tag = secrets.token_urlsafe(10)
|
||||
files[tag] = value
|
||||
data["thumb"] = f"attach://{tag}"
|
||||
elif isinstance(value, InputFile):
|
||||
files[name] = value
|
||||
else:
|
||||
data[name] = value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue