mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 13:29:47 +00:00
Improve permission-related errors (#1231)
This commit is contained in:
@@ -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')
|
||||
|
||||
|
Reference in New Issue
Block a user