juliobm algunos videos algunas notas algunos scripts aprendiendo

Get-Customer-File-with-Telegram

This is how I get the customer file with Telegram. All my customer history files are in plain text and saved on my server, so I can use a big variety of tools to update and read them.

I send to my Telegram contact a cli xxxx

expcli!

and then I obtain the text file

expclitext!

This is the code that I added to my lua script

	...  
    if (string.sub(mensaje,1,4) == 'CLI ') then  
        local dequien = string.sub(mensaje,5,string.len(mensaje))  
        local expediente = "./pawb/exp/" .. dequien .. "/" .. dequien .. "_historia.txt"  
        local f = io.open(expediente,"r")  
        if (f ~= nil) then  
            io.close(f)  
            ficdevuelve = 'respuesta_' ..  msg.from.id .. '.txt'  
            ejecuta = "cp "..expediente.." "..ficdevuelve  
            os.execute(ejecuta)  
            send_file (msg.from.print_name, ficdevuelve, ok_cb, false)  
        else  
            send_msg (msg.from.print_name, 'no hay expediente '..dequien, ok_cb, false)  
        end  
        return  
    end  
	...