mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
parent
b9b4885568
commit
f3b1f97362
@ -108,7 +108,6 @@ class AsyncTeleBot:
|
||||
|
||||
self.current_states = state_storage
|
||||
|
||||
|
||||
self.middlewares = []
|
||||
|
||||
async def close_session(self):
|
||||
@ -117,6 +116,7 @@ class AsyncTeleBot:
|
||||
Use this function if you stop polling.
|
||||
"""
|
||||
await asyncio_helper.session_manager.session.close()
|
||||
|
||||
async def get_updates(self, offset: Optional[int]=None, limit: Optional[int]=None,
|
||||
timeout: Optional[int]=None, allowed_updates: Optional[List]=None, request_timeout: Optional[int]=None) -> List[types.Update]:
|
||||
json_updates = await asyncio_helper.get_updates(self.token, offset, limit, timeout, allowed_updates, request_timeout)
|
||||
|
@ -1280,6 +1280,21 @@ class ChatMember(JsonDeserializable):
|
||||
if json_string is None: return None
|
||||
obj = cls.check_json(json_string)
|
||||
obj['user'] = User.de_json(obj['user'])
|
||||
member_type = obj['status']
|
||||
if member_type == "creator":
|
||||
return ChatMemberOwner(**obj)
|
||||
elif member_type == "administrator":
|
||||
return ChatMemberAdministrator(**obj)
|
||||
elif member_type == "member":
|
||||
return ChatMemberMember(**obj)
|
||||
elif member_type == "restricted":
|
||||
return ChatMemberRestricted(**obj)
|
||||
elif member_type == "left":
|
||||
return ChatMemberLeft(**obj)
|
||||
elif member_type == "kicked":
|
||||
return ChatMemberBanned(**obj)
|
||||
else:
|
||||
# Should not be here
|
||||
return cls(**obj)
|
||||
|
||||
def __init__(self, user, status, custom_title=None, is_anonymous=None, can_be_edited=None,
|
||||
@ -1318,6 +1333,7 @@ class ChatMember(JsonDeserializable):
|
||||
class ChatMemberOwner(ChatMember):
|
||||
pass
|
||||
|
||||
|
||||
class ChatMemberAdministrator(ChatMember):
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user