Fix some misleading errors/documentation

This commit is contained in:
Lonami Exo 2017-09-18 09:37:20 +02:00
parent 2a3e5e5ed2
commit e0e3947d2f
2 changed files with 18 additions and 9 deletions

View File

@ -22,7 +22,9 @@ class ChannelInvalidError(BadRequestError):
def __init__(self, **kwargs):
super(Exception, self).__init__(
self,
'Invalid channel object. Make sure to pass the right types.'
'Invalid channel object. Make sure to pass the right types,'
' for instance making sure that the request is designed for '
'channels or otherwise look for a different one more suited.'
)
@ -40,7 +42,12 @@ class ChatIdInvalidError(BadRequestError):
def __init__(self, **kwargs):
super(Exception, self).__init__(
self,
'Invalid object ID for a chat. Make sure to pass the right types.'
'Invalid object ID for a chat. Make sure to pass the right types,'
' for instance making sure that the request is designed for chats'
' (not channels/megagroups) or otherwise look for a different one'
' more suited.\nAn example working with a megagroup and'
' AddChatUserRequest, it will fail because megagroups are channels'
'. Use InviteToChannelRequest instead.'
)
@ -48,7 +55,8 @@ class ConnectionLangPackInvalid(BadRequestError):
def __init__(self, **kwargs):
super(Exception, self).__init__(
self,
'The specified language pack is not valid.'
'The specified language pack is not valid. This is meant to be '
'used by official applications only so far, leave it empty.'
)
@ -284,7 +292,7 @@ class UsernameInvalidError(BadRequestError):
def __init__(self, **kwargs):
super(Exception, self).__init__(
self,
'Unacceptable username. Must match r"[a-zA-Z][\w\d]{4,31}"'
'Unacceptable username. Must match r"[a-zA-Z][\w\d]{4,31}".'
)
@ -292,7 +300,7 @@ class UsernameNotModifiedError(BadRequestError):
def __init__(self, **kwargs):
super(Exception, self).__init__(
self,
'The username is not different from the current username'
'The username is not different from the current username.'
)
@ -300,7 +308,7 @@ class UsernameNotOccupiedError(BadRequestError):
def __init__(self, **kwargs):
super(Exception, self).__init__(
self,
'See issue #96 for Telethon - try upgrading the library.'
'The username is not in use by anyone else yet.'
)
@ -333,7 +341,9 @@ class UserIdInvalidError(BadRequestError):
def __init__(self, **kwargs):
super(Exception, self).__init__(
self,
'Invalid object ID for an user. Make sure to pass the right types.'
'Invalid object ID for an user. Make sure to pass the right types,'
'for instance making sure that the request is designed for users'
'or otherwise look for a different one more suited.'
)

View File

@ -292,8 +292,7 @@ class TelegramClient(TelegramBareClient):
If no phone or code is provided, then the sole password will be used.
The password should be used after a normal authorization attempt
has happened and an RPCError with `.password_required = True` was
raised.
has happened and an SessionPasswordNeededError was raised.
To login as a bot, only `bot_token` should be provided.
This should equal to the bot access hash provided by