问题描述
自从我写客户端以来,我的美国朋友注意到代码不通过短信,而只能通过电话。但我不明白怎么做,如何请求一个电话(
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 (将#修改为@)