Код: Выделить всё
pyrogram.errors.exceptions.bad_request_400.PhoneCodeExpired: Telegram says: [400 PHONE_CODE_EXPIRED] - The confirmation code has expired (caused by "auth.SignIn")мой код:
Код: Выделить всё
@app.on_message(contacts)
async def register_mobile(client, message):
user_number = message.contact.phone_number
user_id = message.from_user.id
# create session for user with phone number
cli = Client("4984920", api_id_975, api_hash_975)
await cli.connect()
code = await cli.send_code(user_number)
print('we are here')
temp[user_id] = [cli,user_number,code]
print(temp)
await message.reply(
f"send telegram code to bot"
)
@app.on_message()
async def handler4(c,m):
print('here we are')
if (data:=temp[m.from_user.id]):
cli,phone_number,code = data
print(code)
ramz = str(m.text)
print(ramz,len(ramz),type(ramz))
await cli.sign_in(f'{phone_number}',f'{code.phone_code_hash}',ramz)
print('done')
string_session = await cli.export_session_string()
print(f"Session String:\n{string_session}")
Подробнее здесь: https://stackoverflow.com/questions/791 ... -exception
Мобильная версия