@@ -75,6 +75,12 @@ class User(Object):
7575 language_code (``str``, *optional*):
7676 IETF language tag of the user's language.
7777
78+ dc_id (``int``, *optional*):
79+ User's or bot's assigned DC (data center). Available only in case the user has set a public profile photo.
80+ Note that this information is approximate: it is based on where Telegram stores a user profile pictures and
81+ does not by any means tell you the user location (i.e. a user might travel far away, but will still connect
82+ to its assigned DC). More info at `FAQs </faq#what-are-the-ip-addresses-of-telegram-data-centers>`_.
83+
7884 phone_number (``str``, *optional*):
7985 User's phone number.
8086
@@ -88,8 +94,8 @@ class User(Object):
8894
8995 __slots__ = [
9096 "id" , "is_self" , "is_contact" , "is_mutual_contact" , "is_deleted" , "is_bot" , "is_verified" , "is_restricted" ,
91- "is_scam" , "is_support" , "first_name" , "last_name" , "status" , "username" , "language_code" , "phone_number " ,
92- "photo" , "restriction_reason"
97+ "is_scam" , "is_support" , "first_name" , "last_name" , "status" , "username" , "language_code" , "dc_id " ,
98+ "phone_number" , " photo" , "restriction_reason"
9399 ]
94100
95101 def __init__ (
@@ -111,6 +117,7 @@ def __init__(
111117 status : UserStatus = None ,
112118 username : str = None ,
113119 language_code : str = None ,
120+ dc_id : int = None ,
114121 phone_number : str = None ,
115122 photo : ChatPhoto = None ,
116123 restriction_reason : str = None
@@ -132,6 +139,7 @@ def __init__(
132139 self .status = status
133140 self .username = username
134141 self .language_code = language_code
142+ self .dc_id = dc_id
135143 self .phone_number = phone_number
136144 self .photo = photo
137145 self .restriction_reason = restriction_reason
@@ -163,6 +171,7 @@ def _parse(client, user: types.User) -> "User" or None:
163171 status = UserStatus ._parse (client , user .status , user .id , user .bot ),
164172 username = user .username ,
165173 language_code = user .lang_code ,
174+ dc_id = getattr (user .photo , "dc_id" , None ),
166175 phone_number = user .phone ,
167176 photo = ChatPhoto ._parse (client , user .photo , user .id ),
168177 restriction_reason = user .restriction_reason ,
@@ -214,7 +223,7 @@ def unarchive(self):
214223 """
215224
216225 return self ._client .unarchive_chats (self .id )
217-
226+
218227 def block (self ):
219228 """Bound method *block* of :obj:`User`.
220229
@@ -238,7 +247,6 @@ def block(self):
238247
239248 return self ._client .block_user (self .id )
240249
241-
242250 def unblock (self ):
243251 """Bound method *unblock* of :obj:`User`.
244252
@@ -261,4 +269,3 @@ def unblock(self):
261269 """
262270
263271 return self ._client .unblock_user (self .id )
264-
0 commit comments