mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
commit
e0e6eee374
@ -108,7 +108,6 @@ class AsyncTeleBot:
|
|||||||
|
|
||||||
self.current_states = state_storage
|
self.current_states = state_storage
|
||||||
|
|
||||||
|
|
||||||
self.middlewares = []
|
self.middlewares = []
|
||||||
|
|
||||||
async def close_session(self):
|
async def close_session(self):
|
||||||
@ -117,6 +116,7 @@ class AsyncTeleBot:
|
|||||||
Use this function if you stop polling.
|
Use this function if you stop polling.
|
||||||
"""
|
"""
|
||||||
await asyncio_helper.session_manager.session.close()
|
await asyncio_helper.session_manager.session.close()
|
||||||
|
|
||||||
async def get_updates(self, offset: Optional[int]=None, limit: Optional[int]=None,
|
async def get_updates(self, offset: Optional[int]=None, limit: Optional[int]=None,
|
||||||
timeout: Optional[int]=20, allowed_updates: Optional[List]=None, request_timeout: Optional[int]=None) -> List[types.Update]:
|
timeout: Optional[int]=20, allowed_updates: Optional[List]=None, request_timeout: Optional[int]=None) -> List[types.Update]:
|
||||||
"""
|
"""
|
||||||
|
@ -1248,9 +1248,10 @@ class CallbackQuery(JsonDeserializable):
|
|||||||
obj['from_user'] = User.de_json(obj.pop('from'))
|
obj['from_user'] = User.de_json(obj.pop('from'))
|
||||||
if 'message' in obj:
|
if 'message' in obj:
|
||||||
obj['message'] = Message.de_json(obj.get('message'))
|
obj['message'] = Message.de_json(obj.get('message'))
|
||||||
|
obj['json_string'] = json_string
|
||||||
return cls(**obj)
|
return cls(**obj)
|
||||||
|
|
||||||
def __init__(self, id, from_user, data, chat_instance, message=None, inline_message_id=None, game_short_name=None, **kwargs):
|
def __init__(self, id, from_user, data, chat_instance, json_string, message=None, inline_message_id=None, game_short_name=None, **kwargs):
|
||||||
self.id: int = id
|
self.id: int = id
|
||||||
self.from_user: User = from_user
|
self.from_user: User = from_user
|
||||||
self.message: Message = message
|
self.message: Message = message
|
||||||
@ -1258,6 +1259,7 @@ class CallbackQuery(JsonDeserializable):
|
|||||||
self.chat_instance: str = chat_instance
|
self.chat_instance: str = chat_instance
|
||||||
self.data: str = data
|
self.data: str = data
|
||||||
self.game_short_name: str = game_short_name
|
self.game_short_name: str = game_short_name
|
||||||
|
self.json = json_string
|
||||||
|
|
||||||
|
|
||||||
class ChatPhoto(JsonDeserializable):
|
class ChatPhoto(JsonDeserializable):
|
||||||
@ -1280,6 +1282,22 @@ class ChatMember(JsonDeserializable):
|
|||||||
if json_string is None: return None
|
if json_string is None: return None
|
||||||
obj = cls.check_json(json_string)
|
obj = cls.check_json(json_string)
|
||||||
obj['user'] = User.de_json(obj['user'])
|
obj['user'] = User.de_json(obj['user'])
|
||||||
|
member_type = obj['status']
|
||||||
|
# Ordered according to estimated appearance frequency.
|
||||||
|
if member_type == "member":
|
||||||
|
return ChatMemberMember(**obj)
|
||||||
|
elif member_type == "left":
|
||||||
|
return ChatMemberLeft(**obj)
|
||||||
|
elif member_type == "kicked":
|
||||||
|
return ChatMemberBanned(**obj)
|
||||||
|
elif member_type == "restricted":
|
||||||
|
return ChatMemberRestricted(**obj)
|
||||||
|
elif member_type == "administrator":
|
||||||
|
return ChatMemberAdministrator(**obj)
|
||||||
|
elif member_type == "creator":
|
||||||
|
return ChatMemberOwner(**obj)
|
||||||
|
else:
|
||||||
|
# Should not be here. For "if something happen" compatibility
|
||||||
return cls(**obj)
|
return cls(**obj)
|
||||||
|
|
||||||
def __init__(self, user, status, custom_title=None, is_anonymous=None, can_be_edited=None,
|
def __init__(self, user, status, custom_title=None, is_anonymous=None, can_be_edited=None,
|
||||||
@ -1318,6 +1336,7 @@ class ChatMember(JsonDeserializable):
|
|||||||
class ChatMemberOwner(ChatMember):
|
class ChatMemberOwner(ChatMember):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ChatMemberAdministrator(ChatMember):
|
class ChatMemberAdministrator(ChatMember):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ content_type_service = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
update_types = [
|
update_types = [
|
||||||
"update_id", "message", "edited_message", "channel_post", "edited_channel_post", "inline_query",
|
"message", "edited_message", "channel_post", "edited_channel_post", "inline_query",
|
||||||
"chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer",
|
"chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer",
|
||||||
"my_chat_member", "chat_member", "chat_join_request"
|
"my_chat_member", "chat_member", "chat_join_request"
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user