mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +03:00
Review errors and remove some type checks
If the type is not correct, we can let the API fail instead. This way, if the API supports more types in the future, there does not need to be an update. This has affected participant permissions in groups.
This commit is contained in:
parent
4fae119a18
commit
d1836ab899
|
@ -484,8 +484,6 @@ async def edit_admin(
|
|||
entity = await self.get_input_entity(entity)
|
||||
user = await self.get_input_entity(user)
|
||||
ty = helpers._entity_type(user)
|
||||
if ty != helpers._EntityType.USER:
|
||||
raise ValueError('You must pass a user entity')
|
||||
|
||||
perm_names = (
|
||||
'change_info', 'post_messages', 'edit_messages', 'delete_messages',
|
||||
|
@ -549,8 +547,6 @@ async def edit_permissions(
|
|||
pin_messages: bool = True) -> _tl.Updates:
|
||||
entity = await self.get_input_entity(entity)
|
||||
ty = helpers._entity_type(entity)
|
||||
if ty != helpers._EntityType.CHANNEL:
|
||||
raise ValueError('You must pass either a channel or a supergroup')
|
||||
|
||||
rights = _tl.ChatBannedRights(
|
||||
until_date=until_date,
|
||||
|
@ -592,8 +588,6 @@ async def kick_participant(
|
|||
):
|
||||
entity = await self.get_input_entity(entity)
|
||||
user = await self.get_input_entity(user)
|
||||
if helpers._entity_type(user) != helpers._EntityType.USER:
|
||||
raise ValueError('You must pass a user entity')
|
||||
|
||||
ty = helpers._entity_type(entity)
|
||||
if ty == helpers._EntityType.CHAT:
|
||||
|
@ -660,8 +654,6 @@ async def get_stats(
|
|||
message: 'typing.Union[int, _tl.Message]' = None,
|
||||
):
|
||||
entity = await self.get_input_entity(entity)
|
||||
if helpers._entity_type(entity) != helpers._EntityType.CHANNEL:
|
||||
raise TypeError('You must pass a channel entity')
|
||||
|
||||
message = utils.get_message_id(message)
|
||||
if message is not None:
|
||||
|
|
|
@ -157,7 +157,7 @@ def init(
|
|||
if not api_id or not api_hash:
|
||||
raise ValueError(
|
||||
"Your API ID or Hash cannot be empty or None. "
|
||||
"Refer to telethon.rtfd.io for more information.")
|
||||
"Refer to docs.telethon.dev for more information.")
|
||||
|
||||
if local_addr is not None:
|
||||
if use_ipv6 is False and ':' in local_addr:
|
||||
|
|
Loading…
Reference in New Issue
Block a user