1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #890 from Otxoto/master

Update User type
Added:
can_join_groups
can_read_all_group_messages
supports_inline_queries
This commit is contained in:
Badiboy 2020-06-22 23:14:45 +03:00 committed by GitHub
commit 03b1531bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,15 +157,21 @@ class User(JsonDeserializable, Dictionaryable, JsonSerializable):
last_name = obj.get('last_name') last_name = obj.get('last_name')
username = obj.get('username') username = obj.get('username')
language_code = obj.get('language_code') language_code = obj.get('language_code')
return cls(id, is_bot, first_name, last_name, username, language_code) can_join_groups = obj.get('can_join_groups')
can_read_all_group_messages = obj.get('can_read_all_group_messages')
supports_inline_queries = obj.get('supports_inline_queries')
return cls(id, is_bot, first_name, last_name, username, language_code, can_join_groups, can_read_all_group_messages, supports_inline_queries)
def __init__(self, id, is_bot, first_name, last_name=None, username=None, language_code=None): def __init__(self, id, is_bot, first_name, last_name=None, username=None, language_code=None, can_join_groups=None, can_read_all_group_messages=None, supports_inline_queries=None):
self.id = id self.id = id
self.is_bot = is_bot self.is_bot = is_bot
self.first_name = first_name self.first_name = first_name
self.username = username self.username = username
self.last_name = last_name self.last_name = last_name
self.language_code = language_code self.language_code = language_code
self.can_join_groups = can_join_groups
self.can_read_all_group_messages = can_read_all_group_messages
self.supports_inline_queries = supports_inline_queries
def to_json(self): def to_json(self):
return json.dumps(self.to_dict()) return json.dumps(self.to_dict())
@ -176,7 +182,10 @@ class User(JsonDeserializable, Dictionaryable, JsonSerializable):
'first_name': self.first_name, 'first_name': self.first_name,
'last_name': self.last_name, 'last_name': self.last_name,
'username': self.username, 'username': self.username,
'language_code': self.language_code} 'language_code': self.language_code,
'can_join_groups': self.can_join_groups,
'can_read_all_group_messages': self.can_read_all_group_messages,
'supports_inline_queries': self.supports_inline_queries}
class GroupChat(JsonDeserializable): class GroupChat(JsonDeserializable):