mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Merge remote-tracking branch 'origin/dev-3.x' into dev-3.x
This commit is contained in:
commit
fa979c96e5
159 changed files with 1409 additions and 1055 deletions
20
Makefile
20
Makefile
|
|
@ -4,6 +4,8 @@ base_python := python3
|
|||
py := poetry run
|
||||
python := $(py) python
|
||||
|
||||
reports_dir := reports
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "======================================================================================="
|
||||
|
|
@ -79,8 +81,8 @@ flake8:
|
|||
|
||||
.PHONY: flake8-report
|
||||
flake8-report:
|
||||
mkdir -p reports/flake8
|
||||
$(py) flake8 --format=html --htmldir=reports/flake8 aiogram test
|
||||
mkdir -p $(reports_dir)/flake8
|
||||
$(py) flake8 --format=html --htmldir=$(reports_dir)/flake8 aiogram test
|
||||
|
||||
.PHONY: mypy
|
||||
mypy:
|
||||
|
|
@ -88,7 +90,7 @@ mypy:
|
|||
|
||||
.PHONY: mypy-report
|
||||
mypy-report:
|
||||
$(py) mypy aiogram tests --html-report reports/typechecking
|
||||
$(py) mypy aiogram tests --html-report $(reports_dir)/typechecking
|
||||
|
||||
.PHONY: lint
|
||||
lint: isort black flake8 mypy
|
||||
|
|
@ -99,13 +101,13 @@ lint: isort black flake8 mypy
|
|||
|
||||
.PHONY: test
|
||||
test:
|
||||
$(py) pytest --cov=aiogram --cov-config .coveragerc -p no:warnings tests/
|
||||
$(py) pytest --cov=aiogram --cov-config .coveragerc tests/
|
||||
|
||||
.PHONY: test-coverage
|
||||
test-coverage:
|
||||
mkdir -p reports/tests/
|
||||
$(py) pytest --cov=aiogram --cov-config .coveragerc --html=reports/tests/index.html -p no:warnings tests/
|
||||
$(py) coverage html -d reports/coverage
|
||||
mkdir -p $(reports_dir)/tests/
|
||||
$(py) pytest --cov=aiogram --cov-config .coveragerc --html=$(reports_dir)/tests/index.html tests/
|
||||
$(py) coverage html -d $(reports_dir)/coverage
|
||||
|
||||
# =================================================================================================
|
||||
# Docs
|
||||
|
|
@ -121,7 +123,7 @@ docs-serve:
|
|||
|
||||
.PHONY: docs-copy-reports
|
||||
docs-copy-reports:
|
||||
mv reports/* site/reports
|
||||
mv $(reports_dir)/* site/reports
|
||||
|
||||
|
||||
# =================================================================================================
|
||||
|
|
@ -129,7 +131,7 @@ docs-copy-reports:
|
|||
# =================================================================================================
|
||||
|
||||
.PHONY: build
|
||||
build: clean tests test-coverage flake8-report mypy-report docs docs-copy-reports
|
||||
build: clean flake8-report mypy-report test-coverage docs docs-copy-reports
|
||||
mkdir -p site/simple
|
||||
poetry build
|
||||
mv dist site/simple/aiogram
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
[](https://core.telegram.org/bots/api)
|
||||
[](https://core.telegram.org/bots/api)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
[](https://pypi.python.org/pypi/aiogram)
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ __all__ = (
|
|||
"handler",
|
||||
)
|
||||
|
||||
__version__ = "3.0.0a0"
|
||||
__api_version__ = "4.4"
|
||||
__version__ = "3.0.0a1"
|
||||
__api_version__ = "4.5"
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class BaseBot(ContextInstanceMixin, DataMixin):
|
|||
"""
|
||||
return extract_bot_id(self.__token)
|
||||
|
||||
async def emit(self, method: TelegramMethod[T]) -> T:
|
||||
async def __call__(self, method: TelegramMethod[T]) -> T:
|
||||
"""
|
||||
Call API method
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ from ..methods import (
|
|||
SendVideo,
|
||||
SendVideoNote,
|
||||
SendVoice,
|
||||
SetChatAdministratorCustomTitle,
|
||||
SetChatDescription,
|
||||
SetChatPermissions,
|
||||
SetChatPhoto,
|
||||
|
|
@ -154,7 +155,7 @@ class Bot(BaseBot):
|
|||
call = GetUpdates(
|
||||
offset=offset, limit=limit, timeout=timeout, allowed_updates=allowed_updates
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_webhook(
|
||||
self,
|
||||
|
|
@ -204,7 +205,7 @@ class Bot(BaseBot):
|
|||
max_connections=max_connections,
|
||||
allowed_updates=allowed_updates,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def delete_webhook(self,) -> bool:
|
||||
"""
|
||||
|
|
@ -216,7 +217,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = DeleteWebhook()
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_webhook_info(self,) -> WebhookInfo:
|
||||
"""
|
||||
|
|
@ -230,7 +231,7 @@ class Bot(BaseBot):
|
|||
return an object with the url field empty.
|
||||
"""
|
||||
call = GetWebhookInfo()
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
# =============================================================================================
|
||||
# Group: Available methods
|
||||
|
|
@ -247,7 +248,7 @@ class Bot(BaseBot):
|
|||
:return: Returns basic information about the bot in form of a User object.
|
||||
"""
|
||||
call = GetMe()
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_message(
|
||||
self,
|
||||
|
|
@ -289,7 +290,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def forward_message(
|
||||
self,
|
||||
|
|
@ -318,7 +319,7 @@ class Bot(BaseBot):
|
|||
message_id=message_id,
|
||||
disable_notification=disable_notification,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_photo(
|
||||
self,
|
||||
|
|
@ -364,7 +365,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_audio(
|
||||
self,
|
||||
|
|
@ -431,7 +432,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_document(
|
||||
self,
|
||||
|
|
@ -488,7 +489,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_video(
|
||||
self,
|
||||
|
|
@ -557,7 +558,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_animation(
|
||||
self,
|
||||
|
|
@ -623,7 +624,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_voice(
|
||||
self,
|
||||
|
|
@ -675,7 +676,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_video_note(
|
||||
self,
|
||||
|
|
@ -729,7 +730,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_media_group(
|
||||
self,
|
||||
|
|
@ -759,7 +760,7 @@ class Bot(BaseBot):
|
|||
disable_notification=disable_notification,
|
||||
reply_to_message_id=reply_to_message_id,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_location(
|
||||
self,
|
||||
|
|
@ -801,7 +802,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def edit_message_live_location(
|
||||
self,
|
||||
|
|
@ -841,7 +842,7 @@ class Bot(BaseBot):
|
|||
inline_message_id=inline_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def stop_message_live_location(
|
||||
self,
|
||||
|
|
@ -874,7 +875,7 @@ class Bot(BaseBot):
|
|||
inline_message_id=inline_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_venue(
|
||||
self,
|
||||
|
|
@ -927,7 +928,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_contact(
|
||||
self,
|
||||
|
|
@ -971,7 +972,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_poll(
|
||||
self,
|
||||
|
|
@ -1011,7 +1012,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def send_chat_action(self, chat_id: Union[int, str], action: str) -> bool:
|
||||
"""
|
||||
|
|
@ -1037,7 +1038,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = SendChatAction(chat_id=chat_id, action=action)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_user_profile_photos(
|
||||
self, user_id: int, offset: Optional[int] = None, limit: Optional[int] = None
|
||||
|
|
@ -1056,7 +1057,7 @@ class Bot(BaseBot):
|
|||
:return: Returns a UserProfilePhotos object.
|
||||
"""
|
||||
call = GetUserProfilePhotos(user_id=user_id, offset=offset, limit=limit)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_file(self, file_id: str) -> File:
|
||||
"""
|
||||
|
|
@ -1075,7 +1076,7 @@ class Bot(BaseBot):
|
|||
:return: On success, a File object is returned.
|
||||
"""
|
||||
call = GetFile(file_id=file_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def kick_chat_member(
|
||||
self,
|
||||
|
|
@ -1101,7 +1102,7 @@ class Bot(BaseBot):
|
|||
the group on their own using invite links, etc. Returns True on success.
|
||||
"""
|
||||
call = KickChatMember(chat_id=chat_id, user_id=user_id, until_date=until_date)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def unban_chat_member(self, chat_id: Union[int, str], user_id: int) -> bool:
|
||||
"""
|
||||
|
|
@ -1118,7 +1119,7 @@ class Bot(BaseBot):
|
|||
to join via link, etc. Returns True on success.
|
||||
"""
|
||||
call = UnbanChatMember(chat_id=chat_id, user_id=user_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def restrict_chat_member(
|
||||
self,
|
||||
|
|
@ -1146,7 +1147,7 @@ class Bot(BaseBot):
|
|||
call = RestrictChatMember(
|
||||
chat_id=chat_id, user_id=user_id, permissions=permissions, until_date=until_date
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def promote_chat_member(
|
||||
self,
|
||||
|
|
@ -1202,7 +1203,28 @@ class Bot(BaseBot):
|
|||
can_pin_messages=can_pin_messages,
|
||||
can_promote_members=can_promote_members,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_chat_administrator_custom_title(
|
||||
self, chat_id: Union[int, str], user_id: int, custom_title: str
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to set a custom title for an administrator in a supergroup promoted by the
|
||||
bot. Returns True on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target supergroup
|
||||
(in the format @supergroupusername)
|
||||
:param user_id: Unique identifier of the target user
|
||||
:param custom_title: New custom title for the administrator; 0-16 characters, emoji are
|
||||
not allowed
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
call = SetChatAdministratorCustomTitle(
|
||||
chat_id=chat_id, user_id=user_id, custom_title=custom_title
|
||||
)
|
||||
return await self(call)
|
||||
|
||||
async def set_chat_permissions(
|
||||
self, chat_id: Union[int, str], permissions: ChatPermissions
|
||||
|
|
@ -1220,7 +1242,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = SetChatPermissions(chat_id=chat_id, permissions=permissions)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def export_chat_invite_link(self, chat_id: Union[int, str]) -> str:
|
||||
"""
|
||||
|
|
@ -1240,7 +1262,7 @@ class Bot(BaseBot):
|
|||
:return: Returns the new invite link as String on success.
|
||||
"""
|
||||
call = ExportChatInviteLink(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_chat_photo(self, chat_id: Union[int, str], photo: InputFile) -> bool:
|
||||
"""
|
||||
|
|
@ -1256,7 +1278,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = SetChatPhoto(chat_id=chat_id, photo=photo)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def delete_chat_photo(self, chat_id: Union[int, str]) -> bool:
|
||||
"""
|
||||
|
|
@ -1271,7 +1293,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = DeleteChatPhoto(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_chat_title(self, chat_id: Union[int, str], title: str) -> bool:
|
||||
"""
|
||||
|
|
@ -1287,7 +1309,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = SetChatTitle(chat_id=chat_id, title=title)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_chat_description(
|
||||
self, chat_id: Union[int, str], description: Optional[str] = None
|
||||
|
|
@ -1305,7 +1327,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = SetChatDescription(chat_id=chat_id, description=description)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def pin_chat_message(
|
||||
self,
|
||||
|
|
@ -1332,7 +1354,7 @@ class Bot(BaseBot):
|
|||
call = PinChatMessage(
|
||||
chat_id=chat_id, message_id=message_id, disable_notification=disable_notification
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def unpin_chat_message(self, chat_id: Union[int, str]) -> bool:
|
||||
"""
|
||||
|
|
@ -1348,7 +1370,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = UnpinChatMessage(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def leave_chat(self, chat_id: Union[int, str]) -> bool:
|
||||
"""
|
||||
|
|
@ -1362,7 +1384,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = LeaveChat(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_chat(self, chat_id: Union[int, str]) -> Chat:
|
||||
"""
|
||||
|
|
@ -1377,7 +1399,7 @@ class Bot(BaseBot):
|
|||
:return: Returns a Chat object on success.
|
||||
"""
|
||||
call = GetChat(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_chat_administrators(self, chat_id: Union[int, str]) -> List[ChatMember]:
|
||||
"""
|
||||
|
|
@ -1396,7 +1418,7 @@ class Bot(BaseBot):
|
|||
returned.
|
||||
"""
|
||||
call = GetChatAdministrators(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_chat_members_count(self, chat_id: Union[int, str]) -> int:
|
||||
"""
|
||||
|
|
@ -1409,7 +1431,7 @@ class Bot(BaseBot):
|
|||
:return: Returns Int on success.
|
||||
"""
|
||||
call = GetChatMembersCount(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_chat_member(self, chat_id: Union[int, str], user_id: int) -> ChatMember:
|
||||
"""
|
||||
|
|
@ -1424,7 +1446,7 @@ class Bot(BaseBot):
|
|||
:return: Returns a ChatMember object on success.
|
||||
"""
|
||||
call = GetChatMember(chat_id=chat_id, user_id=user_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_chat_sticker_set(self, chat_id: Union[int, str], sticker_set_name: str) -> bool:
|
||||
"""
|
||||
|
|
@ -1442,7 +1464,7 @@ class Bot(BaseBot):
|
|||
check if the bot can use this method. Returns True on success.
|
||||
"""
|
||||
call = SetChatStickerSet(chat_id=chat_id, sticker_set_name=sticker_set_name)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def delete_chat_sticker_set(self, chat_id: Union[int, str]) -> bool:
|
||||
"""
|
||||
|
|
@ -1459,7 +1481,7 @@ class Bot(BaseBot):
|
|||
check if the bot can use this method. Returns True on success.
|
||||
"""
|
||||
call = DeleteChatStickerSet(chat_id=chat_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def answer_callback_query(
|
||||
self,
|
||||
|
|
@ -1500,7 +1522,7 @@ class Bot(BaseBot):
|
|||
url=url,
|
||||
cache_time=cache_time,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
# =============================================================================================
|
||||
# Group: Updating messages
|
||||
|
|
@ -1547,7 +1569,7 @@ class Bot(BaseBot):
|
|||
disable_web_page_preview=disable_web_page_preview,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def edit_message_caption(
|
||||
self,
|
||||
|
|
@ -1586,7 +1608,7 @@ class Bot(BaseBot):
|
|||
parse_mode=parse_mode,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def edit_message_media(
|
||||
self,
|
||||
|
|
@ -1625,7 +1647,7 @@ class Bot(BaseBot):
|
|||
inline_message_id=inline_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def edit_message_reply_markup(
|
||||
self,
|
||||
|
|
@ -1657,7 +1679,7 @@ class Bot(BaseBot):
|
|||
inline_message_id=inline_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def stop_poll(
|
||||
self,
|
||||
|
|
@ -1678,7 +1700,7 @@ class Bot(BaseBot):
|
|||
:return: On success, the stopped Poll with the final results is returned.
|
||||
"""
|
||||
call = StopPoll(chat_id=chat_id, message_id=message_id, reply_markup=reply_markup)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def delete_message(self, chat_id: Union[int, str], message_id: int) -> bool:
|
||||
"""
|
||||
|
|
@ -1701,7 +1723,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = DeleteMessage(chat_id=chat_id, message_id=message_id)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
# =============================================================================================
|
||||
# Group: Stickers
|
||||
|
|
@ -1745,7 +1767,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_sticker_set(self, name: str) -> StickerSet:
|
||||
"""
|
||||
|
|
@ -1757,7 +1779,7 @@ class Bot(BaseBot):
|
|||
:return: On success, a StickerSet object is returned.
|
||||
"""
|
||||
call = GetStickerSet(name=name)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def upload_sticker_file(self, user_id: int, png_sticker: InputFile) -> File:
|
||||
"""
|
||||
|
|
@ -1774,7 +1796,7 @@ class Bot(BaseBot):
|
|||
:return: Returns the uploaded File on success.
|
||||
"""
|
||||
call = UploadStickerFile(user_id=user_id, png_sticker=png_sticker)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def create_new_sticker_set(
|
||||
self,
|
||||
|
|
@ -1819,7 +1841,7 @@ class Bot(BaseBot):
|
|||
contains_masks=contains_masks,
|
||||
mask_position=mask_position,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def add_sticker_to_set(
|
||||
self,
|
||||
|
|
@ -1854,7 +1876,7 @@ class Bot(BaseBot):
|
|||
emojis=emojis,
|
||||
mask_position=mask_position,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_sticker_position_in_set(self, sticker: str, position: int) -> bool:
|
||||
"""
|
||||
|
|
@ -1868,7 +1890,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = SetStickerPositionInSet(sticker=sticker, position=position)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def delete_sticker_from_set(self, sticker: str) -> bool:
|
||||
"""
|
||||
|
|
@ -1881,7 +1903,7 @@ class Bot(BaseBot):
|
|||
:return: Returns True on success.
|
||||
"""
|
||||
call = DeleteStickerFromSet(sticker=sticker)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
# =============================================================================================
|
||||
# Group: Inline mode
|
||||
|
|
@ -1932,7 +1954,7 @@ class Bot(BaseBot):
|
|||
switch_pm_text=switch_pm_text,
|
||||
switch_pm_parameter=switch_pm_parameter,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
# =============================================================================================
|
||||
# Group: Payments
|
||||
|
|
@ -2035,7 +2057,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def answer_shipping_query(
|
||||
self,
|
||||
|
|
@ -2069,7 +2091,7 @@ class Bot(BaseBot):
|
|||
shipping_options=shipping_options,
|
||||
error_message=error_message,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def answer_pre_checkout_query(
|
||||
self, pre_checkout_query_id: str, ok: bool, error_message: Optional[str] = None
|
||||
|
|
@ -2096,7 +2118,7 @@ class Bot(BaseBot):
|
|||
call = AnswerPreCheckoutQuery(
|
||||
pre_checkout_query_id=pre_checkout_query_id, ok=ok, error_message=error_message
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
# =============================================================================================
|
||||
# Group: Telegram Passport
|
||||
|
|
@ -2125,7 +2147,7 @@ class Bot(BaseBot):
|
|||
Returns True on success.
|
||||
"""
|
||||
call = SetPassportDataErrors(user_id=user_id, errors=errors)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
# =============================================================================================
|
||||
# Group: Games
|
||||
|
|
@ -2163,7 +2185,7 @@ class Bot(BaseBot):
|
|||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def set_game_score(
|
||||
self,
|
||||
|
|
@ -2208,7 +2230,7 @@ class Bot(BaseBot):
|
|||
message_id=message_id,
|
||||
inline_message_id=inline_message_id,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
||||
async def get_game_high_scores(
|
||||
self,
|
||||
|
|
@ -2246,4 +2268,4 @@ class Bot(BaseBot):
|
|||
message_id=message_id,
|
||||
inline_message_id=inline_message_id,
|
||||
)
|
||||
return await self.emit(call)
|
||||
return await self(call)
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ from .send_venue import SendVenue
|
|||
from .send_video import SendVideo
|
||||
from .send_video_note import SendVideoNote
|
||||
from .send_voice import SendVoice
|
||||
from .set_chat_administrator_custom_title import SetChatAdministratorCustomTitle
|
||||
from .set_chat_description import SetChatDescription
|
||||
from .set_chat_permissions import SetChatPermissions
|
||||
from .set_chat_photo import SetChatPhoto
|
||||
|
|
@ -97,6 +98,7 @@ __all__ = (
|
|||
"UnbanChatMember",
|
||||
"RestrictChatMember",
|
||||
"PromoteChatMember",
|
||||
"SetChatAdministratorCustomTitle",
|
||||
"SetChatPermissions",
|
||||
"ExportChatInviteLink",
|
||||
"SetChatPhoto",
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class TelegramMethod(abc.ABC, BaseModel, Generic[T]):
|
|||
return Response[self.__returning__](**data) # type: ignore
|
||||
|
||||
async def emit(self, bot: Bot) -> T:
|
||||
return await bot.emit(self)
|
||||
return await bot(self)
|
||||
|
||||
def __await__(self):
|
||||
from aiogram.api.client.bot import Bot
|
||||
|
|
|
|||
27
aiogram/api/methods/set_chat_administrator_custom_title.py
Normal file
27
aiogram/api/methods/set_chat_administrator_custom_title.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from typing import Any, Dict, Union
|
||||
|
||||
from .base import Request, TelegramMethod
|
||||
|
||||
|
||||
class SetChatAdministratorCustomTitle(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to set a custom title for an administrator in a supergroup promoted by the
|
||||
bot. Returns True on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target supergroup (in the format
|
||||
@supergroupusername)"""
|
||||
user_id: int
|
||||
"""Unique identifier of the target user"""
|
||||
custom_title: str
|
||||
"""New custom title for the administrator; 0-16 characters, emoji are not allowed"""
|
||||
|
||||
def build_request(self) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="setChatAdministratorCustomTitle", data=data)
|
||||
|
|
@ -16,7 +16,10 @@ class Animation(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
width: int
|
||||
"""Video width as defined by sender"""
|
||||
height: int
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class Audio(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
duration: int
|
||||
"""Duration of the audio in seconds as defined by sender"""
|
||||
performer: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from typing import TYPE_CHECKING, Optional
|
|||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from .chat_photo import ChatPhoto
|
||||
from .message import Message
|
||||
from .chat_photo import ChatPhoto
|
||||
from .chat_permissions import ChatPermissions
|
||||
|
||||
|
||||
|
|
@ -44,6 +44,9 @@ class Chat(TelegramObject):
|
|||
"""Pinned message, for groups, supergroups and channels. Returned only in getChat."""
|
||||
permissions: Optional[ChatPermissions] = None
|
||||
"""Default chat member permissions, for groups and supergroups. Returned only in getChat."""
|
||||
slow_mode_delay: Optional[int] = None
|
||||
"""For supergroups, the minimum allowed delay between consecutive messages sent by each
|
||||
unpriviledged user. Returned only in getChat."""
|
||||
sticker_set_name: Optional[str] = None
|
||||
"""For supergroups, name of group sticker set. Returned only in getChat."""
|
||||
can_set_sticker_set: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ class ChatMember(TelegramObject):
|
|||
status: str
|
||||
"""The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted',
|
||||
'left' or 'kicked'"""
|
||||
custom_title: Optional[str] = None
|
||||
"""Owner and administrators only. Custom title for this user"""
|
||||
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None
|
||||
"""Restricted and kicked only. Date when restrictions will be lifted for this user; unix time"""
|
||||
can_be_edited: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ class ChatPhoto(TelegramObject):
|
|||
small_file_id: str
|
||||
"""File identifier of small (160x160) chat photo. This file_id can be used only for photo
|
||||
download and only for as long as the photo is not changed."""
|
||||
small_file_unique_id: str
|
||||
"""Unique file identifier of small (160x160) chat photo, which is supposed to be the same over
|
||||
time and for different bots. Can't be used to download or reuse the file."""
|
||||
big_file_id: str
|
||||
"""File identifier of big (640x640) chat photo. This file_id can be used only for photo
|
||||
download and only for as long as the photo is not changed."""
|
||||
big_file_unique_id: str
|
||||
"""Unique file identifier of big (640x640) chat photo, which is supposed to be the same over
|
||||
time and for different bots. Can't be used to download or reuse the file."""
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class Document(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
thumb: Optional[PhotoSize] = None
|
||||
"""Document thumbnail as defined by sender"""
|
||||
file_name: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ class File(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
file_size: Optional[int] = None
|
||||
"""File size, if known"""
|
||||
file_path: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ class MessageEntity(TelegramObject):
|
|||
"""
|
||||
|
||||
type: str
|
||||
"""Type of the entity. Can be mention (@username), hashtag, cashtag, bot_command, url, email,
|
||||
phone_number, bold (bold text), italic (italic text), code (monowidth string), pre
|
||||
(monowidth block), text_link (for clickable text URLs), text_mention (for users without
|
||||
usernames)"""
|
||||
"""Type of the entity. Can be 'mention' (@username), 'hashtag' (#hashtag), 'cashtag' ($USD),
|
||||
'bot_command' (/start@jobs_bot), 'url' (https://telegram.org), 'email'
|
||||
(do-not-reply@telegram.org), 'phone_number' (+1-212-555-0123), 'bold' (bold text), 'italic'
|
||||
(italic text), 'underline' (underlined text), 'strikethrough' (strikethrough text), 'code'
|
||||
(monowidth string), 'pre' (monowidth block), 'text_link' (for clickable text URLs),
|
||||
'text_mention' (for users without usernames)"""
|
||||
offset: int
|
||||
"""Offset in UTF-16 code units to the start of the entity"""
|
||||
length: int
|
||||
|
|
|
|||
|
|
@ -12,7 +12,10 @@ class PassportFile(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
file_size: int
|
||||
"""File size"""
|
||||
file_date: int
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ class PhotoSize(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
width: int
|
||||
"""Photo width"""
|
||||
height: int
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ from pydantic import Field
|
|||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from .user import User
|
||||
from .shipping_address import ShippingAddress
|
||||
from .user import User
|
||||
|
||||
|
||||
class ShippingQuery(TelegramObject):
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from typing import TYPE_CHECKING, Optional
|
|||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from .photo_size import PhotoSize
|
||||
from .mask_position import MaskPosition
|
||||
from .photo_size import PhotoSize
|
||||
|
||||
|
||||
class Sticker(TelegramObject):
|
||||
|
|
@ -17,7 +17,10 @@ class Sticker(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
width: int
|
||||
"""Sticker width"""
|
||||
height: int
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class Video(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
width: int
|
||||
"""Video width as defined by sender"""
|
||||
height: int
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class VideoNote(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
length: int
|
||||
"""Video width and height (diameter of the video message) as defined by sender"""
|
||||
duration: int
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ class Voice(TelegramObject):
|
|||
"""
|
||||
|
||||
file_id: str
|
||||
"""Identifier for this file"""
|
||||
"""Identifier for this file, which can be used to download or reuse the file"""
|
||||
file_unique_id: str
|
||||
"""Unique identifier for this file, which is supposed to be the same over time and for
|
||||
different bots. Can't be used to download or reuse the file."""
|
||||
duration: int
|
||||
"""Duration of the audio in seconds as defined by sender"""
|
||||
mime_type: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from .text_decorations import html, markdown
|
||||
from .text_decorations import html_decoration, markdown_decoration
|
||||
|
||||
LIST_MD_SYMBOLS = "*_`["
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ def bold(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return markdown.bold.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return markdown_decoration.bold.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def hbold(*content, sep=" "):
|
||||
|
|
@ -52,7 +52,7 @@ def hbold(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return html.bold.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return html_decoration.bold.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def italic(*content, sep=" "):
|
||||
|
|
@ -63,7 +63,7 @@ def italic(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return markdown.italic.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return markdown_decoration.italic.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def hitalic(*content, sep=" "):
|
||||
|
|
@ -74,7 +74,7 @@ def hitalic(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return html.italic.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return html_decoration.italic.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def code(*content, sep=" "):
|
||||
|
|
@ -85,7 +85,7 @@ def code(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return markdown.code.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return markdown_decoration.code.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def hcode(*content, sep=" "):
|
||||
|
|
@ -96,7 +96,7 @@ def hcode(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return html.code.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return html_decoration.code.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def pre(*content, sep="\n"):
|
||||
|
|
@ -107,7 +107,7 @@ def pre(*content, sep="\n"):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return markdown.pre.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return markdown_decoration.pre.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def hpre(*content, sep="\n"):
|
||||
|
|
@ -118,7 +118,7 @@ def hpre(*content, sep="\n"):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return html.pre.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return html_decoration.pre.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def underline(*content, sep=" "):
|
||||
|
|
@ -129,7 +129,9 @@ def underline(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return markdown.underline.format(value=markdown.quote(_join(*content, sep=sep)))
|
||||
return markdown_decoration.underline.format(
|
||||
value=markdown_decoration.quote(_join(*content, sep=sep))
|
||||
)
|
||||
|
||||
|
||||
def hunderline(*content, sep=" "):
|
||||
|
|
@ -140,7 +142,7 @@ def hunderline(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return html.underline.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return html_decoration.underline.format(value=html_decoration.quote(_join(*content, sep=sep)))
|
||||
|
||||
|
||||
def strikethrough(*content, sep=" "):
|
||||
|
|
@ -151,7 +153,9 @@ def strikethrough(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return markdown.strikethrough.format(value=markdown.quote(_join(*content, sep=sep)))
|
||||
return markdown_decoration.strikethrough.format(
|
||||
value=markdown_decoration.quote(_join(*content, sep=sep))
|
||||
)
|
||||
|
||||
|
||||
def hstrikethrough(*content, sep=" "):
|
||||
|
|
@ -162,7 +166,9 @@ def hstrikethrough(*content, sep=" "):
|
|||
:param sep:
|
||||
:return:
|
||||
"""
|
||||
return html.strikethrough.format(value=html.quote(_join(*content, sep=sep)))
|
||||
return html_decoration.strikethrough.format(
|
||||
value=html_decoration.quote(_join(*content, sep=sep))
|
||||
)
|
||||
|
||||
|
||||
def link(title: str, url: str) -> str:
|
||||
|
|
@ -173,7 +179,7 @@ def link(title: str, url: str) -> str:
|
|||
:param url:
|
||||
:return:
|
||||
"""
|
||||
return markdown.link.format(value=html.quote(title), link=url)
|
||||
return markdown_decoration.link.format(value=html_decoration.quote(title), link=url)
|
||||
|
||||
|
||||
def hlink(title: str, url: str) -> str:
|
||||
|
|
@ -184,7 +190,7 @@ def hlink(title: str, url: str) -> str:
|
|||
:param url:
|
||||
:return:
|
||||
"""
|
||||
return html.link.format(value=html.quote(title), link=url)
|
||||
return html_decoration.link.format(value=html_decoration.quote(title), link=url)
|
||||
|
||||
|
||||
def hide_link(url: str) -> str:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,13 @@ from typing import AnyStr, Callable, Generator, Iterable, List, Optional
|
|||
|
||||
from aiogram.api.types import MessageEntity
|
||||
|
||||
__all__ = ("TextDecoration", "html", "markdown", "add_surrogate", "remove_surrogate")
|
||||
__all__ = (
|
||||
"TextDecoration",
|
||||
"html_decoration",
|
||||
"markdown_decoration",
|
||||
"add_surrogate",
|
||||
"remove_surrogate",
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
@ -82,7 +88,7 @@ class TextDecoration:
|
|||
yield self.quote(text[offset:length])
|
||||
|
||||
|
||||
html = TextDecoration(
|
||||
html_decoration = TextDecoration(
|
||||
link='<a href="{link}">{value}</a>',
|
||||
bold="<b>{value}</b>",
|
||||
italic="<i>{value}</i>",
|
||||
|
|
@ -93,18 +99,18 @@ html = TextDecoration(
|
|||
quote=html.escape,
|
||||
)
|
||||
|
||||
markdown = TextDecoration(
|
||||
MARKDOWN_QUOTE_PATTERN = re.compile(r"([_*\[\]()~`>#+\-|{}.!])")
|
||||
|
||||
markdown_decoration = TextDecoration(
|
||||
link="[{value}]({link})",
|
||||
bold="*{value}*",
|
||||
italic="_{value}_",
|
||||
italic="_{value}_\r",
|
||||
code="`{value}`",
|
||||
pre="```{value}```",
|
||||
underline="--{value}--", # Is not supported
|
||||
strikethrough="~~{value}~~", # Is not supported
|
||||
quote=lambda text: re.sub(
|
||||
pattern=r"([*_`\[])", repl=r"\\\1", string=text
|
||||
), # Is not always helpful
|
||||
) # Markdown is not recommended for usage. Use HTML instead
|
||||
underline="__{value}__",
|
||||
strikethrough="~{value}~",
|
||||
quote=lambda text: re.sub(pattern=MARKDOWN_QUOTE_PATTERN, repl=r"\\\1", string=text),
|
||||
)
|
||||
|
||||
|
||||
def add_surrogate(text: str) -> str:
|
||||
|
|
|
|||
|
|
@ -41,24 +41,25 @@ Imports:
|
|||
- `from aiogram.api.methods import AddStickerToSet`
|
||||
- `from aiogram.api.methods.add_sticker_to_set import AddStickerToSet`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return AddStickerToSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(AddStickerToSet(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await AddStickerToSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(AddStickerToSet(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return AddStickerToSet(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#addstickertoset)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.MaskPosition](../types/mask_position.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -43,21 +43,21 @@ Imports:
|
|||
- `from aiogram.api.methods import AnswerCallbackQuery`
|
||||
- `from aiogram.api.methods.answer_callback_query import AnswerCallbackQuery`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return AnswerCallbackQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(AnswerCallbackQuery(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await AnswerCallbackQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(AnswerCallbackQuery(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return AnswerCallbackQuery(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -45,21 +45,21 @@ Imports:
|
|||
- `from aiogram.api.methods import AnswerInlineQuery`
|
||||
- `from aiogram.api.methods.answer_inline_query import AnswerInlineQuery`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return AnswerInlineQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(AnswerInlineQuery(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await AnswerInlineQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(AnswerInlineQuery(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return AnswerInlineQuery(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,21 +39,21 @@ Imports:
|
|||
- `from aiogram.api.methods import AnswerPreCheckoutQuery`
|
||||
- `from aiogram.api.methods.answer_pre_checkout_query import AnswerPreCheckoutQuery`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return AnswerPreCheckoutQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(AnswerPreCheckoutQuery(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await AnswerPreCheckoutQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(AnswerPreCheckoutQuery(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return AnswerPreCheckoutQuery(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ Imports:
|
|||
- `from aiogram.api.methods import AnswerShippingQuery`
|
||||
- `from aiogram.api.methods.answer_shipping_query import AnswerShippingQuery`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return AnswerShippingQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(AnswerShippingQuery(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await AnswerShippingQuery(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(AnswerShippingQuery(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return AnswerShippingQuery(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -43,24 +43,25 @@ Imports:
|
|||
- `from aiogram.api.methods import CreateNewStickerSet`
|
||||
- `from aiogram.api.methods.create_new_sticker_set import CreateNewStickerSet`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return CreateNewStickerSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(CreateNewStickerSet(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await CreateNewStickerSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(CreateNewStickerSet(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return CreateNewStickerSet(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#createnewstickerset)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.MaskPosition](../types/mask_position.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ Imports:
|
|||
- `from aiogram.api.methods import DeleteChatPhoto`
|
||||
- `from aiogram.api.methods.delete_chat_photo import DeleteChatPhoto`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return DeleteChatPhoto(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(DeleteChatPhoto(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await DeleteChatPhoto(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(DeleteChatPhoto(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return DeleteChatPhoto(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ Imports:
|
|||
- `from aiogram.api.methods import DeleteChatStickerSet`
|
||||
- `from aiogram.api.methods.delete_chat_sticker_set import DeleteChatStickerSet`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return DeleteChatStickerSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(DeleteChatStickerSet(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await DeleteChatStickerSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(DeleteChatStickerSet(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return DeleteChatStickerSet(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -52,21 +52,21 @@ Imports:
|
|||
- `from aiogram.api.methods import DeleteMessage`
|
||||
- `from aiogram.api.methods.delete_message import DeleteMessage`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return DeleteMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(DeleteMessage(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await DeleteMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(DeleteMessage(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return DeleteMessage(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ Imports:
|
|||
- `from aiogram.api.methods import DeleteStickerFromSet`
|
||||
- `from aiogram.api.methods.delete_sticker_from_set import DeleteStickerFromSet`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return DeleteStickerFromSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(DeleteStickerFromSet(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await DeleteStickerFromSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(DeleteStickerFromSet(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return DeleteStickerFromSet(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -33,18 +33,18 @@ Imports:
|
|||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return DeleteWebhook(...)
|
||||
result: bool = await DeleteWebhook(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(DeleteWebhook(...))
|
||||
result: bool = await bot(DeleteWebhook(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return DeleteWebhook(...)
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await DeleteWebhook(...)
|
||||
```
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
|
|
|||
|
|
@ -42,21 +42,21 @@ Imports:
|
|||
- `from aiogram.api.methods import EditMessageCaption`
|
||||
- `from aiogram.api.methods.edit_message_caption import EditMessageCaption`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return EditMessageCaption(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot.emit(EditMessageCaption(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await EditMessageCaption(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot(EditMessageCaption(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return EditMessageCaption(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -42,21 +42,21 @@ Imports:
|
|||
- `from aiogram.api.methods import EditMessageLiveLocation`
|
||||
- `from aiogram.api.methods.edit_message_live_location import EditMessageLiveLocation`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return EditMessageLiveLocation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot.emit(EditMessageLiveLocation(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await EditMessageLiveLocation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot(EditMessageLiveLocation(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return EditMessageLiveLocation(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -41,21 +41,21 @@ Imports:
|
|||
- `from aiogram.api.methods import EditMessageMedia`
|
||||
- `from aiogram.api.methods.edit_message_media import EditMessageMedia`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return EditMessageMedia(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot.emit(EditMessageMedia(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await EditMessageMedia(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot(EditMessageMedia(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return EditMessageMedia(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ Imports:
|
|||
- `from aiogram.api.methods import EditMessageReplyMarkup`
|
||||
- `from aiogram.api.methods.edit_message_reply_markup import EditMessageReplyMarkup`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return EditMessageReplyMarkup(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot.emit(EditMessageReplyMarkup(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await EditMessageReplyMarkup(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot(EditMessageReplyMarkup(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return EditMessageReplyMarkup(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -43,21 +43,21 @@ Imports:
|
|||
- `from aiogram.api.methods import EditMessageText`
|
||||
- `from aiogram.api.methods.edit_message_text import EditMessageText`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return EditMessageText(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot.emit(EditMessageText(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await EditMessageText(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot(EditMessageText(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return EditMessageText(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,21 +39,21 @@ Imports:
|
|||
- `from aiogram.api.methods import ExportChatInviteLink`
|
||||
- `from aiogram.api.methods.export_chat_invite_link import ExportChatInviteLink`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return ExportChatInviteLink(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: str = await bot.emit(ExportChatInviteLink(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: str = await ExportChatInviteLink(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: str = await bot(ExportChatInviteLink(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return ExportChatInviteLink(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ Imports:
|
|||
- `from aiogram.api.methods import ForwardMessage`
|
||||
- `from aiogram.api.methods.forward_message import ForwardMessage`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return ForwardMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(ForwardMessage(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await ForwardMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(ForwardMessage(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return ForwardMessage(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetChat`
|
||||
- `from aiogram.api.methods.get_chat import GetChat`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Chat = await bot.emit(GetChat(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Chat = await GetChat(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Chat = await bot(GetChat(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetChatAdministrators`
|
||||
- `from aiogram.api.methods.get_chat_administrators import GetChatAdministrators`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[ChatMember] = await bot.emit(GetChatAdministrators(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: List[ChatMember] = await GetChatAdministrators(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[ChatMember] = await bot(GetChatAdministrators(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -38,17 +38,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetChatMember`
|
||||
- `from aiogram.api.methods.get_chat_member import GetChatMember`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: ChatMember = await bot.emit(GetChatMember(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: ChatMember = await GetChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: ChatMember = await bot(GetChatMember(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetChatMembersCount`
|
||||
- `from aiogram.api.methods.get_chat_members_count import GetChatMembersCount`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: int = await bot.emit(GetChatMembersCount(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: int = await GetChatMembersCount(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: int = await bot(GetChatMembersCount(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,17 +39,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetFile`
|
||||
- `from aiogram.api.methods.get_file import GetFile`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: File = await bot.emit(GetFile(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: File = await GetFile(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: File = await bot(GetFile(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -42,17 +42,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetGameHighScores`
|
||||
- `from aiogram.api.methods.get_game_high_scores import GetGameHighScores`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[GameHighScore] = await bot.emit(GetGameHighScores(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: List[GameHighScore] = await GetGameHighScores(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[GameHighScore] = await bot(GetGameHighScores(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -31,17 +31,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetMe`
|
||||
- `from aiogram.api.methods.get_me import GetMe`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: User = await bot.emit(GetMe(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: User = await GetMe(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: User = await bot(GetMe(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetStickerSet`
|
||||
- `from aiogram.api.methods.get_sticker_set import GetStickerSet`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: StickerSet = await bot.emit(GetStickerSet(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: StickerSet = await GetStickerSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: StickerSet = await bot(GetStickerSet(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -46,17 +46,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetUpdates`
|
||||
- `from aiogram.api.methods.get_updates import GetUpdates`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[Update] = await bot.emit(GetUpdates(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: List[Update] = await GetUpdates(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[Update] = await bot(GetUpdates(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,17 +39,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetUserProfilePhotos`
|
||||
- `from aiogram.api.methods.get_user_profile_photos import GetUserProfilePhotos`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: UserProfilePhotos = await bot.emit(GetUserProfilePhotos(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: UserProfilePhotos = await GetUserProfilePhotos(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: UserProfilePhotos = await bot(GetUserProfilePhotos(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -31,17 +31,17 @@ Imports:
|
|||
- `from aiogram.api.methods import GetWebhookInfo`
|
||||
- `from aiogram.api.methods.get_webhook_info import GetWebhookInfo`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: WebhookInfo = await bot.emit(GetWebhookInfo(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: WebhookInfo = await GetWebhookInfo(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: WebhookInfo = await bot(GetWebhookInfo(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,21 +39,21 @@ Imports:
|
|||
- `from aiogram.api.methods import KickChatMember`
|
||||
- `from aiogram.api.methods.kick_chat_member import KickChatMember`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return KickChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(KickChatMember(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await KickChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(KickChatMember(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return KickChatMember(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ Imports:
|
|||
- `from aiogram.api.methods import LeaveChat`
|
||||
- `from aiogram.api.methods.leave_chat import LeaveChat`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return LeaveChat(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(LeaveChat(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await LeaveChat(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(LeaveChat(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return LeaveChat(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,21 +39,21 @@ Imports:
|
|||
- `from aiogram.api.methods import PinChatMessage`
|
||||
- `from aiogram.api.methods.pin_chat_message import PinChatMessage`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return PinChatMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(PinChatMessage(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await PinChatMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(PinChatMessage(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return PinChatMessage(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -46,21 +46,21 @@ Imports:
|
|||
- `from aiogram.api.methods import PromoteChatMember`
|
||||
- `from aiogram.api.methods.promote_chat_member import PromoteChatMember`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return PromoteChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(PromoteChatMember(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await PromoteChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(PromoteChatMember(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return PromoteChatMember(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ Imports:
|
|||
- `from aiogram.api.methods import RestrictChatMember`
|
||||
- `from aiogram.api.methods.restrict_chat_member import RestrictChatMember`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return RestrictChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(RestrictChatMember(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await RestrictChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(RestrictChatMember(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return RestrictChatMember(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -47,28 +47,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendAnimation`
|
||||
- `from aiogram.api.methods.send_animation import SendAnimation`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendAnimation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendAnimation(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendAnimation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendAnimation(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendAnimation(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendanimation)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -49,28 +49,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendAudio`
|
||||
- `from aiogram.api.methods.send_audio import SendAudio`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendAudio(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendAudio(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendAudio(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendAudio(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendAudio(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendaudio)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -42,21 +42,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SendChatAction`
|
||||
- `from aiogram.api.methods.send_chat_action import SendChatAction`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendChatAction(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SendChatAction(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SendChatAction(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SendChatAction(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendChatAction(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -44,27 +44,27 @@ Imports:
|
|||
- `from aiogram.api.methods import SendContact`
|
||||
- `from aiogram.api.methods.send_contact import SendContact`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendContact(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendContact(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendContact(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendContact(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendContact(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendcontact)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
|
|
|
|||
|
|
@ -44,28 +44,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendDocument`
|
||||
- `from aiogram.api.methods.send_document import SendDocument`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendDocument(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendDocument(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendDocument(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendDocument(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendDocument(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#senddocument)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -41,21 +41,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SendGame`
|
||||
- `from aiogram.api.methods.send_game import SendGame`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendGame(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendGame(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendGame(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendGame(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendGame(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -59,25 +59,25 @@ Imports:
|
|||
- `from aiogram.api.methods import SendInvoice`
|
||||
- `from aiogram.api.methods.send_invoice import SendInvoice`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendInvoice(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendInvoice(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendInvoice(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendInvoice(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendInvoice(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendinvoice)
|
||||
- [aiogram.types.LabeledPrice](../types/labeled_price.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.LabeledPrice](../types/labeled_price.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
|
|
|
|||
|
|
@ -43,27 +43,27 @@ Imports:
|
|||
- `from aiogram.api.methods import SendLocation`
|
||||
- `from aiogram.api.methods.send_location import SendLocation`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendLocation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendLocation(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendLocation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendLocation(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendLocation(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendlocation)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SendMediaGroup`
|
||||
- `from aiogram.api.methods.send_media_group import SendMediaGroup`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendMediaGroup(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[Message] = await bot.emit(SendMediaGroup(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: List[Message] = await SendMediaGroup(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: List[Message] = await bot(SendMediaGroup(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendMediaGroup(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -43,27 +43,27 @@ Imports:
|
|||
- `from aiogram.api.methods import SendMessage`
|
||||
- `from aiogram.api.methods.send_message import SendMessage`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendMessage(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendMessage(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendMessage(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendmessage)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
|
|
|
|||
|
|
@ -43,28 +43,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendPhoto`
|
||||
- `from aiogram.api.methods.send_photo import SendPhoto`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendPhoto(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendPhoto(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendPhoto(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendPhoto(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendPhoto(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendphoto)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -42,27 +42,27 @@ Imports:
|
|||
- `from aiogram.api.methods import SendPoll`
|
||||
- `from aiogram.api.methods.send_poll import SendPoll`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendPoll(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendPoll(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendPoll(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendPoll(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendPoll(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendpoll)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
|
|
|
|||
|
|
@ -41,28 +41,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendSticker`
|
||||
- `from aiogram.api.methods.send_sticker import SendSticker`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendSticker(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendSticker(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendSticker(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendSticker(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendSticker(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendsticker)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -46,27 +46,27 @@ Imports:
|
|||
- `from aiogram.api.methods import SendVenue`
|
||||
- `from aiogram.api.methods.send_venue import SendVenue`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendVenue(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendVenue(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendVenue(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendVenue(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendVenue(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendvenue)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
|
|
|
|||
|
|
@ -48,28 +48,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendVideo`
|
||||
- `from aiogram.api.methods.send_video import SendVideo`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendVideo(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendVideo(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendVideo(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendVideo(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendVideo(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendvideo)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -44,28 +44,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendVideoNote`
|
||||
- `from aiogram.api.methods.send_video_note import SendVideoNote`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendVideoNote(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendVideoNote(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendVideoNote(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendVideoNote(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendVideoNote(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendvideonote)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -44,28 +44,29 @@ Imports:
|
|||
- `from aiogram.api.methods import SendVoice`
|
||||
- `from aiogram.api.methods.send_voice import SendVoice`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SendVoice(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot.emit(SendVoice(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Message = await SendVoice(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Message = await bot(SendVoice(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SendVoice(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#sendvoice)
|
||||
- [aiogram.types.ForceReply](../types/force_reply.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.InlineKeyboardMarkup](../types/inline_keyboard_markup.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.ReplyKeyboardMarkup](../types/reply_keyboard_markup.md)
|
||||
- [aiogram.types.ReplyKeyboardRemove](../types/reply_keyboard_remove.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
60
docs/api/methods/set_chat_administrator_custom_title.md
Normal file
60
docs/api/methods/set_chat_administrator_custom_title.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# setChatAdministratorCustomTitle
|
||||
|
||||
## Description
|
||||
|
||||
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
|
||||
|
||||
|
||||
## Arguments
|
||||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) |
|
||||
| `user_id` | `#!python3 int` | Unique identifier of the target user |
|
||||
| `custom_title` | `#!python3 str` | New custom title for the administrator; 0-16 characters, emoji are not allowed |
|
||||
|
||||
|
||||
|
||||
## Response
|
||||
|
||||
Type: `#!python3 bool`
|
||||
|
||||
Description: Returns True on success.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
### As bot method bot
|
||||
|
||||
```python3
|
||||
result: bool = await bot.set_chat_administrator_custom_title(...)
|
||||
```
|
||||
|
||||
### Method as object
|
||||
|
||||
Imports:
|
||||
|
||||
- `from aiogram.methods import SetChatAdministratorCustomTitle`
|
||||
- `from aiogram.api.methods import SetChatAdministratorCustomTitle`
|
||||
- `from aiogram.api.methods.set_chat_administrator_custom_title import SetChatAdministratorCustomTitle`
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetChatAdministratorCustomTitle(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetChatAdministratorCustomTitle(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetChatAdministratorCustomTitle(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#setchatadministratorcustomtitle)
|
||||
|
|
@ -38,21 +38,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SetChatDescription`
|
||||
- `from aiogram.api.methods.set_chat_description import SetChatDescription`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetChatDescription(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetChatDescription(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetChatDescription(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetChatDescription(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetChatDescription(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SetChatPermissions`
|
||||
- `from aiogram.api.methods.set_chat_permissions import SetChatPermissions`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetChatPermissions(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetChatPermissions(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetChatPermissions(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetChatPermissions(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetChatPermissions(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -38,19 +38,20 @@ Imports:
|
|||
- `from aiogram.api.methods import SetChatPhoto`
|
||||
- `from aiogram.api.methods.set_chat_photo import SetChatPhoto`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetChatPhoto(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetChatPhoto(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetChatPhoto(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#setchatphoto)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SetChatStickerSet`
|
||||
- `from aiogram.api.methods.set_chat_sticker_set import SetChatStickerSet`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetChatStickerSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetChatStickerSet(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetChatStickerSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetChatStickerSet(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetChatStickerSet(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SetChatTitle`
|
||||
- `from aiogram.api.methods.set_chat_title import SetChatTitle`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetChatTitle(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetChatTitle(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetChatTitle(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetChatTitle(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetChatTitle(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -43,21 +43,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SetGameScore`
|
||||
- `from aiogram.api.methods.set_game_score import SetGameScore`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetGameScore(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot.emit(SetGameScore(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await SetGameScore(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot(SetGameScore(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetGameScore(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SetPassportDataErrors`
|
||||
- `from aiogram.api.methods.set_passport_data_errors import SetPassportDataErrors`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetPassportDataErrors(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetPassportDataErrors(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetPassportDataErrors(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetPassportDataErrors(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetPassportDataErrors(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ Imports:
|
|||
- `from aiogram.api.methods import SetStickerPositionInSet`
|
||||
- `from aiogram.api.methods.set_sticker_position_in_set import SetStickerPositionInSet`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetStickerPositionInSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetStickerPositionInSet(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetStickerPositionInSet(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetStickerPositionInSet(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetStickerPositionInSet(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -52,23 +52,24 @@ Imports:
|
|||
- `from aiogram.api.methods import SetWebhook`
|
||||
- `from aiogram.api.methods.set_webhook import SetWebhook`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return SetWebhook(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(SetWebhook(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await SetWebhook(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(SetWebhook(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return SetWebhook(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#setwebhook)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ Imports:
|
|||
- `from aiogram.api.methods import StopMessageLiveLocation`
|
||||
- `from aiogram.api.methods.stop_message_live_location import StopMessageLiveLocation`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return StopMessageLiveLocation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot.emit(StopMessageLiveLocation(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await StopMessageLiveLocation(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Union[Message, bool] = await bot(StopMessageLiveLocation(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return StopMessageLiveLocation(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,21 +39,21 @@ Imports:
|
|||
- `from aiogram.api.methods import StopPoll`
|
||||
- `from aiogram.api.methods.stop_poll import StopPoll`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return StopPoll(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Poll = await bot.emit(StopPoll(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: Poll = await StopPoll(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: Poll = await bot(StopPoll(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return StopPoll(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ Imports:
|
|||
- `from aiogram.api.methods import UnbanChatMember`
|
||||
- `from aiogram.api.methods.unban_chat_member import UnbanChatMember`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return UnbanChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(UnbanChatMember(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await UnbanChatMember(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(UnbanChatMember(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return UnbanChatMember(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ Imports:
|
|||
- `from aiogram.api.methods import UnpinChatMessage`
|
||||
- `from aiogram.api.methods.unpin_chat_message import UnpinChatMessage`
|
||||
|
||||
#### As reply into Webhook
|
||||
```python3
|
||||
return UnpinChatMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot.emit(UnpinChatMessage(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: bool = await UnpinChatMessage(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: bool = await bot(UnpinChatMessage(...))
|
||||
```
|
||||
#### As reply into Webhook in handler
|
||||
```python3
|
||||
return UnpinChatMessage(...)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
|
|
|
|||
|
|
@ -38,20 +38,21 @@ Imports:
|
|||
- `from aiogram.api.methods import UploadStickerFile`
|
||||
- `from aiogram.api.methods.upload_sticker_file import UploadStickerFile`
|
||||
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: File = await bot.emit(UploadStickerFile(...))
|
||||
```
|
||||
|
||||
#### In handlers with current bot
|
||||
```python3
|
||||
result: File = await UploadStickerFile(...)
|
||||
```
|
||||
|
||||
#### With specific bot
|
||||
```python3
|
||||
result: File = await bot(UploadStickerFile(...))
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#uploadstickerfile)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [aiogram.types.File](../types/file.md)
|
||||
- [aiogram.types.InputFile](../types/input_file.md)
|
||||
- [How to upload file?](../sending_files.md)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ This object represents an animation file (GIF or H.264/MPEG-4 AVC video without
|
|||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `file_id` | `#!python str` | Identifier for this file |
|
||||
| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file |
|
||||
| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. |
|
||||
| `width` | `#!python int` | Video width as defined by sender |
|
||||
| `height` | `#!python int` | Video height as defined by sender |
|
||||
| `duration` | `#!python int` | Duration of the video in seconds as defined by sender |
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ This object represents an audio file to be treated as music by the Telegram clie
|
|||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `file_id` | `#!python str` | Identifier for this file |
|
||||
| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file |
|
||||
| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. |
|
||||
| `duration` | `#!python int` | Duration of the audio in seconds as defined by sender |
|
||||
| `performer` | `#!python Optional[str]` | Optional. Performer of the audio as defined by sender or by audio tags |
|
||||
| `title` | `#!python Optional[str]` | Optional. Title of the audio as defined by sender or by audio tags |
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@ NOTE: After the user presses a callback button, Telegram clients will display a
|
|||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#callbackquery)
|
||||
- [aiogram.types.User](../types/user.md)
|
||||
- [aiogram.types.Message](../types/message.md)
|
||||
- [aiogram.types.User](../types/user.md)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ This object represents a chat.
|
|||
| `invite_link` | `#!python Optional[str]` | Optional. Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat. |
|
||||
| `pinned_message` | `#!python Optional[Message]` | Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat. |
|
||||
| `permissions` | `#!python Optional[ChatPermissions]` | Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. |
|
||||
| `slow_mode_delay` | `#!python Optional[int]` | Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only in getChat. |
|
||||
| `sticker_set_name` | `#!python Optional[str]` | Optional. For supergroups, name of group sticker set. Returned only in getChat. |
|
||||
| `can_set_sticker_set` | `#!python Optional[bool]` | Optional. True, if the bot can change the group sticker set. Returned only in getChat. |
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ This object contains information about one member of a chat.
|
|||
| - | - | - |
|
||||
| `user` | `#!python User` | Information about the user |
|
||||
| `status` | `#!python str` | The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', 'left' or 'kicked' |
|
||||
| `custom_title` | `#!python Optional[str]` | Optional. Owner and administrators only. Custom title for this user |
|
||||
| `until_date` | `#!python Optional[Union[int, datetime.datetime, datetime.timedelta]]` | Optional. Restricted and kicked only. Date when restrictions will be lifted for this user; unix time |
|
||||
| `can_be_edited` | `#!python Optional[bool]` | Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user |
|
||||
| `can_post_messages` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can post in the channel; channels only |
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ This object represents a chat photo.
|
|||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `small_file_id` | `#!python str` | File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. |
|
||||
| `small_file_unique_id` | `#!python str` | Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. |
|
||||
| `big_file_id` | `#!python str` | File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. |
|
||||
| `big_file_unique_id` | `#!python str` | Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ This object represents a general file (as opposed to photos, voice messages and
|
|||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `file_id` | `#!python str` | Identifier for this file |
|
||||
| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file |
|
||||
| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. |
|
||||
| `thumb` | `#!python Optional[PhotoSize]` | Optional. Document thumbnail as defined by sender |
|
||||
| `file_name` | `#!python Optional[str]` | Optional. Original filename as defined by sender |
|
||||
| `mime_type` | `#!python Optional[str]` | Optional. MIME type of the file as defined by sender |
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ Maximum file size to download is 20 MB
|
|||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `file_id` | `#!python str` | Identifier for this file |
|
||||
| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file |
|
||||
| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. |
|
||||
| `file_size` | `#!python Optional[int]` | Optional. File size, if known |
|
||||
| `file_path` | `#!python Optional[str]` | Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. |
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ This object represents a game. Use BotFather to create and edit games, their sho
|
|||
## Related pages:
|
||||
|
||||
- [Official documentation](https://core.telegram.org/bots/api#game)
|
||||
- [aiogram.types.MessageEntity](../types/message_entity.md)
|
||||
- [aiogram.types.Animation](../types/animation.md)
|
||||
- [aiogram.types.MessageEntity](../types/message_entity.md)
|
||||
- [aiogram.types.PhotoSize](../types/photo_size.md)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue