简体   繁体   中英

is not a valid SentCodeType pyrogram

after I enter the phone number in the console for the pyrogram, the bot user string app.run() pyrogram gives this error:

Exception has occurred: ValueError <class 'pyrogram.raw.types.auth.sent_code_type_email_code.SentCodeTypeEmailCode'> is not a valid SentCodeType

this was not the case before. earlier it doesnt happend and worked god this happens regardless of the code until the app.run() line. how to fix it?

whole code

from pyrogram  import Client,filters

api_id = my api id
api_hash = my api hash

app = Client(name="my_account",api_id=api_id,api_hash= api_hash)

regions = ("Дніпропетровська_область","Миколаївська_область","Херсонська_область","Запорізька_область","Одеська_область","Київська_область","Вінницька_область","Черкаська_область","Кіровоградська_область","Донецька_область","Харківська_область","Тернопільська_область","Полтавська_область","Львівська_область","ІваноФранківська_область","Чернівецька_область","Рівненська_область","Волинська_область","Житомирська_область","Закарпатська_область","Сумська_область","Чернігівська_область","Хмельницька_область","Луганська_область")

allert = None

@app.on_message(filters.all)
def allert_hendler(client, mess):
    global regions
    global allert
                        
    txt = mess.text
    txt2 = txt.split(" ")
    txt3 = txt2[-1].split("#")
    region = txt3[1]
    time = txt2[1]
    if region in regions:
        if txt2[0] == "🔴":
            allert = ["Тривога",1]
        elif txt2[0] == "🟢":
            allert = ["Відбій", 0]
        elif txt2[0] == "🟡":
            allert = ["частковий відбій",0]

    app.send_message(chat_id=-786324633,text=f"{allert[1]},{region},{time}")

app.run()

I tryed to redownload pyrogram and tgcrypto. I tryed to change code and keep only part which code need to work, but it happend again

In December, additional verification was introduced (due to spam), now core.telegram.org/api/auth#email-verification

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM