Fix accept TOS must be called after sign up (#824)

This commit is contained in:
Lonami Exo 2018-06-03 16:47:19 +02:00
parent 997f2b62ce
commit fe3172b2c9

View File

@ -503,10 +503,8 @@ class TelegramClient(TelegramBareClient):
t = self.parse_mode.unparse(self._tos.text, self._tos.entities)
else:
t = self._tos.text
sys.stderr.write("By signing up you agree to Telegram's TOS:"
"\n{}\n".format(t))
sys.stderr.write("{}\n".format(t))
sys.stderr.flush()
self(AcceptTermsOfServiceRequest(self._tos.id))
result = self(SignUpRequest(
phone_number=self._phone,
@ -516,6 +514,9 @@ class TelegramClient(TelegramBareClient):
last_name=last_name
))
if self._tos:
self(AcceptTermsOfServiceRequest(self._tos.id))
self._self_input_peer = utils.get_input_peer(
result.user, allow_self=False
)