mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Update methods. Add generated files configurator
This commit is contained in:
parent
87393f2475
commit
9d980c4b61
67 changed files with 230 additions and 165 deletions
|
|
@ -95,9 +95,10 @@ from ..types import (
|
||||||
WebhookInfo,
|
WebhookInfo,
|
||||||
)
|
)
|
||||||
from .base import BaseBot
|
from .base import BaseBot
|
||||||
|
from ...utils.mixins import ContextInstanceMixin
|
||||||
|
|
||||||
|
|
||||||
class Bot(BaseBot):
|
class Bot(ContextInstanceMixin, BaseBot):
|
||||||
"""
|
"""
|
||||||
Class where located all API methods
|
Class where located all API methods
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InputFile, MaskPosition
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InputFile, MaskPosition
|
||||||
|
|
||||||
|
|
||||||
class AddStickerToSet(TelegramMethod[bool]):
|
class AddStickerToSet(TelegramMethod[bool]):
|
||||||
|
|
@ -29,6 +29,9 @@ class AddStickerToSet(TelegramMethod[bool]):
|
||||||
"""A JSON-serialized object for position where the mask should be placed on faces"""
|
"""A JSON-serialized object for position where the mask should be placed on faces"""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"png_sticker"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="png_sticker", value=self.png_sticker)
|
||||||
|
|
||||||
return Request(method="addStickerToSet", data=data, files=files)
|
return Request(method="addStickerToSet", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,5 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="answerCallbackQuery", data=data, files=files)
|
return Request(method="answerCallbackQuery", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ..types import InlineQueryResult
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineQueryResult
|
||||||
|
|
||||||
|
|
||||||
class AnswerInlineQuery(TelegramMethod[bool]):
|
class AnswerInlineQuery(TelegramMethod[bool]):
|
||||||
|
|
@ -39,5 +39,5 @@ class AnswerInlineQuery(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="answerInlineQuery", data=data, files=files)
|
return Request(method="answerInlineQuery", data=data)
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,5 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="answerPreCheckoutQuery", data=data, files=files)
|
return Request(method="answerPreCheckoutQuery", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ..types import ShippingOption
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import ShippingOption
|
||||||
|
|
||||||
|
|
||||||
class AnswerShippingQuery(TelegramMethod[bool]):
|
class AnswerShippingQuery(TelegramMethod[bool]):
|
||||||
|
|
@ -27,5 +27,5 @@ class AnswerShippingQuery(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="answerShippingQuery", data=data, files=files)
|
return Request(method="answerShippingQuery", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,16 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import io
|
import io
|
||||||
from typing import Any, Dict, Generic, Optional, Type, TypeVar, Union
|
from typing import TYPE_CHECKING, Any, Dict, Generic, Optional, Type, TypeVar, Union
|
||||||
|
|
||||||
from pydantic import BaseConfig, BaseModel, Extra
|
from pydantic import BaseConfig, BaseModel, Extra
|
||||||
from pydantic.generics import GenericModel
|
from pydantic.generics import GenericModel
|
||||||
|
|
||||||
from aiogram.api.types import InputFile, ResponseParameters
|
from ..types import InputFile, ResponseParameters
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..client.bot import Bot
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
@ -47,3 +52,18 @@ class TelegramMethod(abc.ABC, BaseModel, Generic[T]):
|
||||||
def build_response(self, data: Dict[str, Any]) -> Response[T]:
|
def build_response(self, data: Dict[str, Any]) -> Response[T]:
|
||||||
# noinspection PyTypeChecker
|
# noinspection PyTypeChecker
|
||||||
return Response[self.__returning__](**data) # type: ignore
|
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):
|
||||||
|
files[name] = value
|
||||||
|
else:
|
||||||
|
data[name] = value
|
||||||
|
|
||||||
|
async def emit(self, bot: Bot) -> T:
|
||||||
|
return await bot.emit(self)
|
||||||
|
|
||||||
|
def __await__(self):
|
||||||
|
from aiogram.api.client.bot import Bot
|
||||||
|
|
||||||
|
bot = Bot.get_current()
|
||||||
|
return self.emit(bot).__await__()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InputFile, MaskPosition
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InputFile, MaskPosition
|
||||||
|
|
||||||
|
|
||||||
class CreateNewStickerSet(TelegramMethod[bool]):
|
class CreateNewStickerSet(TelegramMethod[bool]):
|
||||||
|
|
@ -35,6 +35,9 @@ class CreateNewStickerSet(TelegramMethod[bool]):
|
||||||
"""A JSON-serialized object for position where the mask should be placed on faces"""
|
"""A JSON-serialized object for position where the mask should be placed on faces"""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"png_sticker"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="png_sticker", value=self.png_sticker)
|
||||||
|
|
||||||
return Request(method="createNewStickerSet", data=data, files=files)
|
return Request(method="createNewStickerSet", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ class DeleteChatPhoto(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="deleteChatPhoto", data=data, files=files)
|
return Request(method="deleteChatPhoto", data=data)
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ class DeleteChatStickerSet(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="deleteChatStickerSet", data=data, files=files)
|
return Request(method="deleteChatStickerSet", data=data)
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,5 @@ class DeleteMessage(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="deleteMessage", data=data, files=files)
|
return Request(method="deleteMessage", data=data)
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ class DeleteStickerFromSet(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="deleteStickerFromSet", data=data, files=files)
|
return Request(method="deleteStickerFromSet", data=data)
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,5 @@ class DeleteWebhook(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="deleteWebhook", data=data, files=files)
|
return Request(method="deleteWebhook", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, Message
|
||||||
|
|
||||||
|
|
||||||
class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
|
class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
@ -33,5 +33,5 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="editMessageCaption", data=data, files=files)
|
return Request(method="editMessageCaption", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, Message
|
||||||
|
|
||||||
|
|
||||||
class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
@ -33,5 +33,5 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="editMessageLiveLocation", data=data, files=files)
|
return Request(method="editMessageLiveLocation", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, InputMedia, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, InputMedia, Message
|
||||||
|
|
||||||
|
|
||||||
class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
|
class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
@ -30,5 +30,5 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="editMessageMedia", data=data, files=files)
|
return Request(method="editMessageMedia", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, Message
|
||||||
|
|
||||||
|
|
||||||
class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
|
class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
@ -27,5 +27,5 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="editMessageReplyMarkup", data=data, files=files)
|
return Request(method="editMessageReplyMarkup", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, Message
|
||||||
|
|
||||||
|
|
||||||
class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
@ -36,5 +36,5 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="editMessageText", data=data, files=files)
|
return Request(method="editMessageText", data=data)
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,5 @@ class ExportChatInviteLink(TelegramMethod[str]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="exportChatInviteLink", data=data, files=files)
|
return Request(method="exportChatInviteLink", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import Message
|
||||||
|
|
||||||
|
|
||||||
class ForwardMessage(TelegramMethod[Message]):
|
class ForwardMessage(TelegramMethod[Message]):
|
||||||
|
|
@ -27,5 +27,5 @@ class ForwardMessage(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="forwardMessage", data=data, files=files)
|
return Request(method="forwardMessage", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
from ..types import Chat
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import Chat
|
||||||
|
|
||||||
|
|
||||||
class GetChat(TelegramMethod[Chat]):
|
class GetChat(TelegramMethod[Chat]):
|
||||||
|
|
@ -18,5 +18,5 @@ class GetChat(TelegramMethod[Chat]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getChat", data=data, files=files)
|
return Request(method="getChat", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Union
|
from typing import Any, Dict, List, Union
|
||||||
|
|
||||||
from ..types import ChatMember
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import ChatMember
|
||||||
|
|
||||||
|
|
||||||
class GetChatAdministrators(TelegramMethod[List[ChatMember]]):
|
class GetChatAdministrators(TelegramMethod[List[ChatMember]]):
|
||||||
|
|
@ -18,5 +18,5 @@ class GetChatAdministrators(TelegramMethod[List[ChatMember]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getChatAdministrators", data=data, files=files)
|
return Request(method="getChatAdministrators", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
from ..types import ChatMember
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import ChatMember
|
||||||
|
|
||||||
|
|
||||||
class GetChatMember(TelegramMethod[ChatMember]):
|
class GetChatMember(TelegramMethod[ChatMember]):
|
||||||
|
|
@ -21,5 +21,5 @@ class GetChatMember(TelegramMethod[ChatMember]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getChatMember", data=data, files=files)
|
return Request(method="getChatMember", data=data)
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ class GetChatMembersCount(TelegramMethod[int]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getChatMembersCount", data=data, files=files)
|
return Request(method="getChatMembersCount", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from ..types import File
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import File
|
||||||
|
|
||||||
|
|
||||||
class GetFile(TelegramMethod[File]):
|
class GetFile(TelegramMethod[File]):
|
||||||
|
|
@ -19,5 +19,5 @@ class GetFile(TelegramMethod[File]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getFile", data=data, files=files)
|
return Request(method="getFile", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ..types import GameHighScore
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import GameHighScore
|
||||||
|
|
||||||
|
|
||||||
class GetGameHighScores(TelegramMethod[List[GameHighScore]]):
|
class GetGameHighScores(TelegramMethod[List[GameHighScore]]):
|
||||||
|
|
@ -28,5 +28,5 @@ class GetGameHighScores(TelegramMethod[List[GameHighScore]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getGameHighScores", data=data, files=files)
|
return Request(method="getGameHighScores", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from ..types import User
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import User
|
||||||
|
|
||||||
|
|
||||||
class GetMe(TelegramMethod[User]):
|
class GetMe(TelegramMethod[User]):
|
||||||
|
|
@ -15,5 +15,5 @@ class GetMe(TelegramMethod[User]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getMe", data=data, files=files)
|
return Request(method="getMe", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from ..types import StickerSet
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import StickerSet
|
||||||
|
|
||||||
|
|
||||||
class GetStickerSet(TelegramMethod[StickerSet]):
|
class GetStickerSet(TelegramMethod[StickerSet]):
|
||||||
|
|
@ -18,5 +18,5 @@ class GetStickerSet(TelegramMethod[StickerSet]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getStickerSet", data=data, files=files)
|
return Request(method="getStickerSet", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ..types import Update
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import Update
|
||||||
|
|
||||||
|
|
||||||
class GetUpdates(TelegramMethod[List[Update]]):
|
class GetUpdates(TelegramMethod[List[Update]]):
|
||||||
|
|
@ -32,5 +32,5 @@ class GetUpdates(TelegramMethod[List[Update]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getUpdates", data=data, files=files)
|
return Request(method="getUpdates", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from ..types import UserProfilePhotos
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import UserProfilePhotos
|
||||||
|
|
||||||
|
|
||||||
class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
|
class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
|
||||||
|
|
@ -24,5 +24,5 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getUserProfilePhotos", data=data, files=files)
|
return Request(method="getUserProfilePhotos", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from ..types import WebhookInfo
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import WebhookInfo
|
||||||
|
|
||||||
|
|
||||||
class GetWebhookInfo(TelegramMethod[WebhookInfo]):
|
class GetWebhookInfo(TelegramMethod[WebhookInfo]):
|
||||||
|
|
@ -15,5 +15,5 @@ class GetWebhookInfo(TelegramMethod[WebhookInfo]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="getWebhookInfo", data=data, files=files)
|
return Request(method="getWebhookInfo", data=data)
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,5 @@ class KickChatMember(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="kickChatMember", data=data, files=files)
|
return Request(method="kickChatMember", data=data)
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ class LeaveChat(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="leaveChat", data=data, files=files)
|
return Request(method="leaveChat", data=data)
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,5 @@ class PinChatMessage(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="pinChatMessage", data=data, files=files)
|
return Request(method="pinChatMessage", data=data)
|
||||||
|
|
|
||||||
|
|
@ -44,5 +44,5 @@ class PromoteChatMember(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="promoteChatMember", data=data, files=files)
|
return Request(method="promoteChatMember", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import ChatPermissions
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import ChatPermissions
|
||||||
|
|
||||||
|
|
||||||
class RestrictChatMember(TelegramMethod[bool]):
|
class RestrictChatMember(TelegramMethod[bool]):
|
||||||
|
|
@ -27,5 +27,5 @@ class RestrictChatMember(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="restrictChatMember", data=data, files=files)
|
return Request(method="restrictChatMember", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendAnimation(TelegramMethod[Message]):
|
class SendAnimation(TelegramMethod[Message]):
|
||||||
|
|
@ -56,6 +56,10 @@ class SendAnimation(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"animation", "thumb"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="animation", value=self.animation)
|
||||||
|
self.prepare_file(data=data, files=files, name="thumb", value=self.thumb)
|
||||||
|
|
||||||
return Request(method="sendAnimation", data=data, files=files)
|
return Request(method="sendAnimation", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendAudio(TelegramMethod[Message]):
|
class SendAudio(TelegramMethod[Message]):
|
||||||
|
|
@ -57,6 +57,10 @@ class SendAudio(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"audio", "thumb"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="audio", value=self.audio)
|
||||||
|
self.prepare_file(data=data, files=files, name="thumb", value=self.thumb)
|
||||||
|
|
||||||
return Request(method="sendAudio", data=data, files=files)
|
return Request(method="sendAudio", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,5 @@ class SendChatAction(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendChatAction", data=data, files=files)
|
return Request(method="sendChatAction", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -7,7 +8,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendContact(TelegramMethod[Message]):
|
class SendContact(TelegramMethod[Message]):
|
||||||
|
|
@ -47,5 +47,5 @@ class SendContact(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendContact", data=data, files=files)
|
return Request(method="sendContact", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendDocument(TelegramMethod[Message]):
|
class SendDocument(TelegramMethod[Message]):
|
||||||
|
|
@ -47,6 +47,10 @@ class SendDocument(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"document", "thumb"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="document", value=self.document)
|
||||||
|
self.prepare_file(data=data, files=files, name="thumb", value=self.thumb)
|
||||||
|
|
||||||
return Request(method="sendDocument", data=data, files=files)
|
return Request(method="sendDocument", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, Message
|
||||||
|
|
||||||
|
|
||||||
class SendGame(TelegramMethod[Message]):
|
class SendGame(TelegramMethod[Message]):
|
||||||
|
|
@ -30,5 +30,5 @@ class SendGame(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendGame", data=data, files=files)
|
return Request(method="sendGame", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, LabeledPrice, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, LabeledPrice, Message
|
||||||
|
|
||||||
|
|
||||||
class SendInvoice(TelegramMethod[Message]):
|
class SendInvoice(TelegramMethod[Message]):
|
||||||
|
|
@ -84,5 +84,5 @@ class SendInvoice(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendInvoice", data=data, files=files)
|
return Request(method="sendInvoice", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -7,7 +8,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendLocation(TelegramMethod[Message]):
|
class SendLocation(TelegramMethod[Message]):
|
||||||
|
|
@ -44,5 +44,5 @@ class SendLocation(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendLocation", data=data, files=files)
|
return Request(method="sendLocation", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
from ..types import InputMediaPhoto, InputMediaVideo, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InputMediaPhoto, InputMediaVideo, Message
|
||||||
|
|
||||||
|
|
||||||
class SendMediaGroup(TelegramMethod[List[Message]]):
|
class SendMediaGroup(TelegramMethod[List[Message]]):
|
||||||
|
|
@ -27,5 +27,5 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendMediaGroup", data=data, files=files)
|
return Request(method="sendMediaGroup", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -7,7 +8,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendMessage(TelegramMethod[Message]):
|
class SendMessage(TelegramMethod[Message]):
|
||||||
|
|
@ -44,5 +44,5 @@ class SendMessage(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendMessage", data=data, files=files)
|
return Request(method="sendMessage", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendPhoto(TelegramMethod[Message]):
|
class SendPhoto(TelegramMethod[Message]):
|
||||||
|
|
@ -44,6 +44,9 @@ class SendPhoto(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"photo"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="photo", value=self.photo)
|
||||||
|
|
||||||
return Request(method="sendPhoto", data=data, files=files)
|
return Request(method="sendPhoto", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -7,7 +8,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendPoll(TelegramMethod[Message]):
|
class SendPoll(TelegramMethod[Message]):
|
||||||
|
|
@ -41,5 +41,5 @@ class SendPoll(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendPoll", data=data, files=files)
|
return Request(method="sendPoll", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendSticker(TelegramMethod[Message]):
|
class SendSticker(TelegramMethod[Message]):
|
||||||
|
|
@ -38,6 +38,9 @@ class SendSticker(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"sticker"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="sticker", value=self.sticker)
|
||||||
|
|
||||||
return Request(method="sendSticker", data=data, files=files)
|
return Request(method="sendSticker", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -7,7 +8,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendVenue(TelegramMethod[Message]):
|
class SendVenue(TelegramMethod[Message]):
|
||||||
|
|
@ -53,5 +53,5 @@ class SendVenue(TelegramMethod[Message]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="sendVenue", data=data, files=files)
|
return Request(method="sendVenue", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendVideo(TelegramMethod[Message]):
|
class SendVideo(TelegramMethod[Message]):
|
||||||
|
|
@ -59,6 +59,10 @@ class SendVideo(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"video", "thumb"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="video", value=self.video)
|
||||||
|
self.prepare_file(data=data, files=files, name="thumb", value=self.thumb)
|
||||||
|
|
||||||
return Request(method="sendVideo", data=data, files=files)
|
return Request(method="sendVideo", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendVideoNote(TelegramMethod[Message]):
|
class SendVideoNote(TelegramMethod[Message]):
|
||||||
|
|
@ -47,6 +47,10 @@ class SendVideoNote(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"video_note", "thumb"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="video_note", value=self.video_note)
|
||||||
|
self.prepare_file(data=data, files=files, name="thumb", value=self.thumb)
|
||||||
|
|
||||||
return Request(method="sendVideoNote", data=data, files=files)
|
return Request(method="sendVideoNote", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
|
from .base import Request, TelegramMethod
|
||||||
from ..types import (
|
from ..types import (
|
||||||
ForceReply,
|
ForceReply,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
|
|
@ -8,7 +9,6 @@ from ..types import (
|
||||||
ReplyKeyboardMarkup,
|
ReplyKeyboardMarkup,
|
||||||
ReplyKeyboardRemove,
|
ReplyKeyboardRemove,
|
||||||
)
|
)
|
||||||
from .base import Request, TelegramMethod
|
|
||||||
|
|
||||||
|
|
||||||
class SendVoice(TelegramMethod[Message]):
|
class SendVoice(TelegramMethod[Message]):
|
||||||
|
|
@ -47,6 +47,9 @@ class SendVoice(TelegramMethod[Message]):
|
||||||
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"voice"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="voice", value=self.voice)
|
||||||
|
|
||||||
return Request(method="sendVoice", data=data, files=files)
|
return Request(method="sendVoice", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,5 @@ class SetChatDescription(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="setChatDescription", data=data, files=files)
|
return Request(method="setChatDescription", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
from ..types import ChatPermissions
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import ChatPermissions
|
||||||
|
|
||||||
|
|
||||||
class SetChatPermissions(TelegramMethod[bool]):
|
class SetChatPermissions(TelegramMethod[bool]):
|
||||||
|
|
@ -21,5 +21,5 @@ class SetChatPermissions(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="setChatPermissions", data=data, files=files)
|
return Request(method="setChatPermissions", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
from ..types import InputFile
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InputFile
|
||||||
|
|
||||||
|
|
||||||
class SetChatPhoto(TelegramMethod[bool]):
|
class SetChatPhoto(TelegramMethod[bool]):
|
||||||
|
|
@ -20,6 +20,9 @@ class SetChatPhoto(TelegramMethod[bool]):
|
||||||
"""New chat photo, uploaded using multipart/form-data"""
|
"""New chat photo, uploaded using multipart/form-data"""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"photo"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="photo", value=self.photo)
|
||||||
|
|
||||||
return Request(method="setChatPhoto", data=data, files=files)
|
return Request(method="setChatPhoto", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,5 @@ class SetChatStickerSet(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="setChatStickerSet", data=data, files=files)
|
return Request(method="setChatStickerSet", data=data)
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,5 @@ class SetChatTitle(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="setChatTitle", data=data, files=files)
|
return Request(method="setChatTitle", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import Message
|
||||||
|
|
||||||
|
|
||||||
class SetGameScore(TelegramMethod[Union[Message, bool]]):
|
class SetGameScore(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
@ -36,5 +36,5 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="setGameScore", data=data, files=files)
|
return Request(method="setGameScore", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from ..types import PassportElementError
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import PassportElementError
|
||||||
|
|
||||||
|
|
||||||
class SetPassportDataErrors(TelegramMethod[bool]):
|
class SetPassportDataErrors(TelegramMethod[bool]):
|
||||||
|
|
@ -22,5 +22,5 @@ class SetPassportDataErrors(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="setPassportDataErrors", data=data, files=files)
|
return Request(method="setPassportDataErrors", data=data)
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,5 @@ class SetStickerPositionInSet(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="setStickerPositionInSet", data=data, files=files)
|
return Request(method="setStickerPositionInSet", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ..types import InputFile
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InputFile
|
||||||
|
|
||||||
|
|
||||||
class SetWebhook(TelegramMethod[bool]):
|
class SetWebhook(TelegramMethod[bool]):
|
||||||
|
|
@ -34,6 +34,9 @@ class SetWebhook(TelegramMethod[bool]):
|
||||||
Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time."""
|
Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"certificate"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="certificate", value=self.certificate)
|
||||||
|
|
||||||
return Request(method="setWebhook", data=data, files=files)
|
return Request(method="setWebhook", data=data, files=files)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, Message
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, Message
|
||||||
|
|
||||||
|
|
||||||
class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
@ -27,5 +27,5 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="stopMessageLiveLocation", data=data, files=files)
|
return Request(method="stopMessageLiveLocation", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from ..types import InlineKeyboardMarkup, Poll
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import InlineKeyboardMarkup, Poll
|
||||||
|
|
||||||
|
|
||||||
class StopPoll(TelegramMethod[Poll]):
|
class StopPoll(TelegramMethod[Poll]):
|
||||||
|
|
@ -24,5 +24,5 @@ class StopPoll(TelegramMethod[Poll]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="stopPoll", data=data, files=files)
|
return Request(method="stopPoll", data=data)
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,5 @@ class UnbanChatMember(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="unbanChatMember", data=data, files=files)
|
return Request(method="unbanChatMember", data=data)
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ class UnpinChatMessage(TelegramMethod[bool]):
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
||||||
files: Dict[str, Any] = {}
|
|
||||||
return Request(method="unpinChatMessage", data=data, files=files)
|
return Request(method="unpinChatMessage", data=data)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from ..types import File, InputFile
|
|
||||||
from .base import Request, TelegramMethod
|
from .base import Request, TelegramMethod
|
||||||
|
from ..types import File, InputFile
|
||||||
|
|
||||||
|
|
||||||
class UploadStickerFile(TelegramMethod[File]):
|
class UploadStickerFile(TelegramMethod[File]):
|
||||||
|
|
@ -20,6 +20,9 @@ class UploadStickerFile(TelegramMethod[File]):
|
||||||
"""Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px."""
|
"""Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px."""
|
||||||
|
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request:
|
||||||
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={})
|
data: Dict[str, Any] = self.dict(exclude_unset=True, exclude={"png_sticker"})
|
||||||
|
|
||||||
files: Dict[str, Any] = {}
|
files: Dict[str, Any] = {}
|
||||||
|
self.prepare_file(data=data, files=files, name="png_sticker", value=self.png_sticker)
|
||||||
|
|
||||||
return Request(method="uploadStickerFile", data=data, files=files)
|
return Request(method="uploadStickerFile", data=data, files=files)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue