Visualize statistics from your Telegram chat dump!
Find a file
2025-04-21 18:44:42 +09:00
tgplot fix file encoding 2025-04-21 18:44:02 +09:00
.gitignore initial 2025-04-20 18:57:27 +09:00
LICENSE initial 2025-04-20 18:57:27 +09:00
pyproject.toml bump version 2025-04-21 18:44:42 +09:00
README.md typo 2025-04-20 19:15:45 +09:00

tgplot

tgplot is a small utility for plotting statistics from your Telegram chat dump.

Here are some example plots:

Word cloud Top of users by number of messages
Number of messages per week day Number of messages per hour of the day

Installing

Instal via pip:

pip install git+https://codeberg.org/arslee07/tgplot.git

Alternatively, you can install tgplot manually:

  1. Clone the repo:
    git clone https://codeberg.org/arslee07/tgplot
    
  2. Go to repository directory:
    cd tgplot
    
  3. Install via pip:
    pip install .
    

Dumping a chat

  1. Go to the chat, click on the title, click on the three dots and select "Export chat history":

  2. Uncheck all media, set the size limit and select the export format "Machine-readable JSON":

  3. Click "Export"

Usage

From tgplot --help:

usage: tgplot [-h] [--timezone TIMEZONE] [--language {ru,en}] [--normal-form] path

positional arguments:
  path                  JSON dump file path

options:
  -h, --help            show this help message and exit
  --timezone, --tz, -t TIMEZONE
                        Timezone identifier (e.g. Europe/Moscow)
  --language, --lang, -l {ru,en}
                        Plots language
  --normal-form, --norm, -n
                        Whether to normalize words for a word cloud

Example:

tgplot ./mydump.json --tz "Europe/Moscow" --lang ru

This will generate plots from mydump.json, with Moscow timezone and Russian labels.

Contributing

Contributions are welcome! Suggest new interesting statistics and plots (or make one by yourself!), fix some bugs, improve code readability.

License

tgplot is licensed under MIT license.