Telegram API 5.3 (#610)

* docs: api version update

* feat: personalized commands

* feat: custom placeholders

* refactor: ChatMember split

* fix: old names for ChatMemberStatus

* refactor: renamed kickChatMember to banChatMember

* style: align params

* refactor: renamed getChatMembersCount to getChatMemberCount (#614)

* feat: resolve ChatMember

* refactor: renamed BotCommandScopeTypes (similar to code style)

* refactor: resolve is a static method

* Construct BotCommandScope from type

* Make BotCommandScope classmethod instead of method

* Use classmethod for ChatMember resolve method

Co-authored-by: Hoi Dmytro <dmytro.hoi@gmail.com>
Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
This commit is contained in:
Oleg A 2021-07-04 23:52:55 +03:00 committed by GitHub
parent e70a76ff63
commit f18e4491c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 455 additions and 126 deletions

View file

@ -427,7 +427,7 @@ async def test_get_chat_administrators(bot: Bot):
""" getChatAdministrators method test """
from .types.dataset import CHAT, CHAT_MEMBER
chat = types.Chat(**CHAT)
member = types.ChatMember(**CHAT_MEMBER)
member = types.ChatMember.resolve(**CHAT_MEMBER)
async with FakeTelegram(message_data=[CHAT_MEMBER, CHAT_MEMBER]):
result = await bot.get_chat_administrators(chat_id=chat.id)
@ -435,14 +435,14 @@ async def test_get_chat_administrators(bot: Bot):
assert len(result) == 2
async def test_get_chat_members_count(bot: Bot):
async def test_get_chat_member_count(bot: Bot):
""" getChatMembersCount method test """
from .types.dataset import CHAT
chat = types.Chat(**CHAT)
count = 5
async with FakeTelegram(message_data=count):
result = await bot.get_chat_members_count(chat_id=chat.id)
result = await bot.get_chat_member_count(chat_id=chat.id)
assert result == count
@ -450,7 +450,7 @@ async def test_get_chat_member(bot: Bot):
""" getChatMember method test """
from .types.dataset import CHAT, CHAT_MEMBER
chat = types.Chat(**CHAT)
member = types.ChatMember(**CHAT_MEMBER)
member = types.ChatMember.resolve(**CHAT_MEMBER)
async with FakeTelegram(message_data=CHAT_MEMBER):
result = await bot.get_chat_member(chat_id=chat.id, user_id=member.user.id)