Warning
It is now possible to export JSON history files. This utility is no longer relevant.
Does what the name says.
In desktop Telegram select Export chat history
option.
Then do:
node . --historyDir /path/to/history --outFile parsed.json
Optionally provide --cleanupNames
argument to get rid of dates and other unwanted stuff in users' nicknames.