vysheng / tg

telegram-cli
GNU General Public License v2.0
6.5k stars 1.54k forks source link

load_document is not working on lua script #1627

Open hydefus opened 5 years ago

hydefus commented 5 years ago

Hi there

Today Lua script with load_document has stop working.

I have the following piece of code on a lua script. The save_file callback is never called.

Does any one has experienced the same today ?

Below the lua code and the log received.

Thank you!!

function save_file(extra, success, file)
    print("save file")
    if success then
       print("sucess")
    end
end

function on_msg_receive (msg)
    if msg.out then
        return
    end

    if msg.media then    ---check if msg is media
        print("process media 1")
        mark_read (msg.from.id, ok_cb, true)
        print("process media 2")
        fromphone = msg.from.phone
        if isempty(fromphone) then
           fromphone = "unknown"
        end

        fromid = msg.from.id
        if isempty(fromid) then
           fromid = "unknownid"
        end
        print("proceso media step " .. msg.id)

        a = {}

       a[0] = fromphone
        a[1] = msg.id
        a[2] = msg.date
        a[3] = fromid
        a[4] = msg.media.type
        a[5] = msg.to.phone

        if msg.media.type == 'document' then
           print("call load_document")
           load_document(msg.id, save_file, a);
        end

        receiver = 'user#id'..msg.from.id
        print("mark_read")
        mark_read (receiver, ok_cb, false)

    end
end

---> Log

process media 1 process media 2 proceso media step 1917801 call load_document mark_read 1917801 [21:57] user#141898667 »»» [document B2C FacturaV3 (1).pdf: type=application/pdf size=460KiB] *** error for query #6745230083553881088: #420 FLOOD_WAIT_5 (HANDLED)