如何解决Telethon 如何使用登录代码请求呼叫
自从我写客户端以来,我的美国朋友注意到代码不通过短信,而只能通过电话。但我不明白怎么做,如何请求一个电话(
await client.connect()
code_settings = types.CodeSettings(
current_number=True,allow_flashcall=False,allow_app_hash=False
)
result = await client(functions.auth.SendCodeRequest(
phone_number=phone,api_id=api_id,api_hash=api_hash,settings=code_settings
))
# time.sleep(10)
result = await client(functions.auth.ResendCodeRequest(
phone_number=phone,phone_code_hash=result.phone_code_hash
))
# time.sleep(20)
result = await client(functions.auth.ResendCodeRequest(
phone_number=phone,phone_code_hash=result.phone_code_hash
))
# result = await client(SentCodeTypeCall(5))
# result = await client(functions.auth.)
while not isinstance(result.type,SentCodeTypeCall):
# time.sleep(10)
result = await client(functions.auth.ResendCodeRequest(
phone_number=phone,phone_code_hash=result.phone_code_hash
))
# time.sleep(20)
# await client(functions.auth.SendCodeRequest(
# phone_number=phone,# api_id=api_id,# api_hash=api_hash,# settings=code_settings
# ))
def code_callback():
code = input('Please enter the code you received: ')
return code
time.sleep(5)
await client.start(phone=phone,code_callback=code_callback)
我认为这不是正确的代码。
我可以告诉 SendCode Request 方法立即调用而不发送短信吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。