Add support for Telegram Bot API 9.1 (#1704)

* Add support for Telegram Bot API 9.1 features, including checklists, gifts, and new methods like `SendChecklist`, `EditMessageChecklist`, and `GetMyStarBalance`. Update changelog and improve `True` field descriptions.

* Bump API Version

* Refactor profile photo types to use `InputProfilePhotoType` enums instead of hardcoded literals

* Refactor imports and clean up redundant code across methods, types, and webhook server classes
This commit is contained in:
Alex Root Junior 2025-07-05 03:02:44 +03:00 committed by GitHub
parent 77ca49518e
commit f060c08d16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
117 changed files with 2565 additions and 466 deletions

View file

@ -0,0 +1,35 @@
import datetime
from aiogram.methods import EditMessageChecklist
from aiogram.types import Chat, InputChecklist, InputChecklistTask, Message
from tests.mocked_bot import MockedBot
class TestEditMessageChecklist:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
EditMessageChecklist,
ok=True,
result=Message(
message_id=42,
date=datetime.datetime.now(),
chat=Chat(id=42, type="private"),
),
)
checklist = InputChecklist(
title="Updated Checklist",
tasks=[
InputChecklistTask(id=1, text="Updated Task 1"),
InputChecklistTask(id=2, text="Updated Task 2"),
],
)
response: Message = await bot.edit_message_checklist(
business_connection_id="test_connection",
chat_id=42,
message_id=42,
checklist=checklist,
)
request = bot.get_request()
assert response == prepare_result.result

View file

@ -0,0 +1,18 @@
from aiogram.methods import GetMyStarBalance
from aiogram.types import StarAmount
from tests.mocked_bot import MockedBot
class TestGetMyStarBalance:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
GetMyStarBalance,
ok=True,
result=StarAmount(
amount=100,
),
)
response: StarAmount = await bot.get_my_star_balance()
request = bot.get_request()
assert response == prepare_result.result

View file

@ -0,0 +1,34 @@
import datetime
from aiogram.methods import SendChecklist
from aiogram.types import Chat, InputChecklist, InputChecklistTask, Message
from tests.mocked_bot import MockedBot
class TestSendChecklist:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
SendChecklist,
ok=True,
result=Message(
message_id=42,
date=datetime.datetime.now(),
chat=Chat(id=42, type="private"),
),
)
checklist = InputChecklist(
title="Test Checklist",
tasks=[
InputChecklistTask(id=1, text="Task 1"),
InputChecklistTask(id=2, text="Task 2"),
],
)
response: Message = await bot.send_checklist(
business_connection_id="test_connection",
chat_id=42,
checklist=checklist,
)
request = bot.get_request()
assert response == prepare_result.result