Added notes to InputPeerSelf

This commit is contained in:
painor 2019-07-10 21:43:17 +01:00 committed by GitHub
parent 97cc4aeb06
commit ab3e0e2769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -847,6 +847,9 @@ class ChatMethods:
"""
entity = await self.get_input_entity(entity)
user = await self.get_input_entity(user)
if isinstance(user, types.InputPeerSelf):
raise ValueError('You cannot admin yourself')
if not isinstance(user, types.InputPeerUser):
raise ValueError('You must pass a user entity')
@ -996,6 +999,9 @@ class ChatMethods:
))
user = await self.get_input_entity(user)
if isinstance(user, types.InputPeerSelf):
raise ValueError("You cannot restrict yourself")
if not isinstance(user, types.InputPeerUser):
raise ValueError('You must pass a user entity')