This thing doesn't work anymore, it slowly degraded as Telegram APIs were updated and who know what's doing. I suggest using the Telethon library in Python. You can try to use this project, but at your risk ;)
This is a Dockerfile to have a recently updated version of telegram-cli working in 2020 without segfaulting. Hopefully...
The corresponding Lua script is here: https://github.com/kenorb-contrib/tg