@emaxe/tuigram 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,78 +1,336 @@
1
1
  # 🚀 TuiGram
2
2
 
3
+ **English** · [Русский](./README.ru.md)
4
+
3
5
  [![npm](https://img.shields.io/npm/v/@emaxe/tuigram)](https://www.npmjs.com/package/@emaxe/tuigram)
4
6
  [![node](https://img.shields.io/node/v/@emaxe/tuigram)](https://nodejs.org)
5
7
  [![license](https://img.shields.io/npm/l/@emaxe/tuigram)](./LICENSE)
8
+ [![downloads](https://img.shields.io/npm/dm/@emaxe/tuigram)](https://www.npmjs.com/package/@emaxe/tuigram)
9
+ [![platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey)](#-installation)
6
10
 
7
- Полнофункциональный терминальный клиент Telegram (TUI + CLI) на Node.js на базе протокола MTProto (`teleproto`).
11
+ A full-featured Telegram terminal client (TUI + CLI) for Node.js, built on the MTProto protocol (`teleproto`).
8
12
 
9
- Позволяет полноценно общаться в Telegram прямо из терминала: просматривать список чатов с разделением по категориям, читать переписку с сохранением форматирования (жирный, курсив, ссылки, подсветка кода), отправлять сообщения, ответы (Reply), редактировать, удалять, ставить реакции и отправлять файлы.
13
+ TuiGram lets you use Telegram entirely from the terminal: browse your dialog list split into categories, read conversations with formatting preserved (bold, italic, links, code highlighting), send messages, reply, edit, delete, react and send files.
10
14
 
11
15
  ```
12
16
  ┌─────────────────────────────────────────────────────────────────────────────────────────────┐
13
- │ 🚀 TuiGram │ Maksim (@maksim) │ ● В сети
14
- │ 👥 Tech Chat [1420 уч.] ✍️ Alex печатает...
17
+ │ 🚀 TuiGram │ Alex Rivers (@alex_rivers) │ ● В сети
18
+ │ 👥 Tech Chat [1420 уч.] ✍️ Sam печатает...
15
19
  ├──────────────────────────────┬──────────────────────────────────────────────────────────────┤
16
- │ [1:Все] [2:ЛС] [3:Группы]...─────── Сегодня ───────
20
+ │ [1:Все] [2:ЛС] [3:Группы] ──────────────── Сегодня ────────────────
17
21
  │ [/] Поиск чатов... │ │
18
- │ 📌 👤 Pavel Durov · Let me… Alex [13:40]
22
+ │ 📌 👤 Sam Lee · Let me know Sam Lee [13:40]
19
23
  │ 👥 Tech Chat · Nice work! [3]│ Have you checked the latest release? │
20
- │ 🤖 BotFather · Done! 12:10 Вы [13:42] ✓✓
21
- │ 📢 News Channel · Дайд… [12] │ ┌─ Ответ на сообщение #1042
24
+ │ 🤖 Deploy Bot · Done! 12:10│
25
+ │ 📢 News Channel · Дайд… [12] │ Sam Lee [13:41]
26
+ │ 👤 Mia Novak · 📷 Фото 9:41 │ 📷 Фото · 1.8 MB │
27
+ │ 💾 Избранное · Ссылка вчр│ │
28
+ │ │ Вы [13:42] ✓✓ │
29
+ │ │ ┌─ Ответ на сообщение #1042 │
22
30
  │ │ Yes, testing it right now! │
23
31
  │ │ 👍 4 🔥 2 │
24
32
  │ ├──────────────────────────────────────────────────────────────┤
25
- │ │ ↩️ Ответ на [Alex]: "Have you checked..." [Esc: Отмена]
26
- │ │ Пишу ответ прямо здесь█
27
- │ │ │
33
+ │ │ ↩️ Ответ на [Sam Lee]: "Have you checked" [Esc]
34
+ │ │ Пишу ответ прямо здесь█
28
35
  ├──────────────────────────────┴──────────────────────────────────────────────────────────────┤
29
- │ [Tab] Панель │ [Enter] Отправить │ [1-6] Вкладки │ [F1] Помощь │ [Ctrl+A] Действия [Ctrl+Q]│
36
+ │ [Tab] Панель │ [Enter] Отправить │ [1-6] Вкладки │ [F1] Помощь │ [Ctrl+Q] Выход
30
37
  └─────────────────────────────────────────────────────────────────────────────────────────────┘
31
38
  ```
32
39
 
40
+ > **Note on localization.** The TUI and CLI interface strings are currently in Russian only.
41
+ > The client itself works with any language of chat content. Localization of the UI is planned —
42
+ > see [CHANGELOG.md](./CHANGELOG.md).
43
+
44
+ ---
45
+
46
+ ## 📑 Table of contents
47
+
48
+ - [Features](#-features)
49
+ - [Screenshots](#-screenshots)
50
+ - [Installation](#-installation)
51
+ - [First run](#-first-run)
52
+ - [Where files are stored](#-where-files-are-stored)
53
+ - [Development](#-development)
54
+ - [Keyboard shortcuts](#️-keyboard-shortcuts)
55
+ - [Slash commands](#-slash-commands-in-the-input-box)
56
+ - [Sending files and images](#-sending-files-and-images)
57
+ - [Themes](#-themes)
58
+ - [Command line usage (CLI)](#️-command-line-usage-cli)
59
+ - [Project structure](#-project-structure)
60
+ - [Security](#-security)
61
+ - [Changelog](#-changelog)
62
+ - [Contributing](#-contributing)
63
+ - [License](#-license)
64
+
33
65
  ---
34
66
 
35
- ## ⚡ Особенности и возможности
36
-
37
- - **Полноценный интерактивный TUI**:
38
- - Двухпанельный адаптивный интерфейс (список чатов слева + история и поле ввода справа);
39
- - Поддержка управления клавиатурой и мышью (клики, прокрутка колесом);
40
- - Категории чатов: Все, Личные (ЛС), Группы, Каналы, Боты, Непрочитанные;
41
- - Мгновенный поиск и фильтрация чатов по названию и `@username` (`/`);
42
- - Отображение статуса набора текста («Собеседник печатает...») в реальном времени;
43
- - Цветовое форматирование Telegram Entities (Bold, Italic, Monospace Code, URLs, Mentions, Spoilers);
44
- - Индикаторы медиа-вложений (фото, видео, документы, голосовые, стикеры, опросы);
45
- - Реакции на сообщения (👍, 🔥, ❤️);
46
- - Бесконечная пагинация истории сообщений вверх (`PageUp` / `Ctrl+U`);
47
- - Контекстные режимы быстрого ответа (Reply `Ctrl+R`) и редактирования (Edit `Ctrl+E`);
48
- - Модальные окна: Справка (`F1` / `?`), Сведения о чате (`Ctrl+P`), Меню действий (`Ctrl+A`), Отправка файла (`Ctrl+O`).
49
- - **Автономный CLI-режим**:
50
- - Быстрая отправка сообщений и файлов из командной строки;
51
- - Просмотр списка диалогов и истории в терминале;
52
- - Потоковый стриминг живых обновлений.
53
- - **Умная конфигурация**:
54
- - Ключи и сессия хранятся в пользовательских директориях ОСпакет остаётся read-only и переживает обновления;
55
- - Безопасное хранение сессии и ключей (`chmod 0600`).
67
+ ## ⚡ Features
68
+
69
+ - **A complete interactive TUI**:
70
+ - Two-pane adaptive layout (dialog list on the left, history and input box on the right);
71
+ - Keyboard and mouse control (clicks, wheel scrolling);
72
+ - Chat categories: All, Direct messages, Groups, Channels, Bots, Unread;
73
+ - Instant search and filtering of chats by title and `@username` (`/`);
74
+ - Live typing indicator ("… is typing");
75
+ - Colored rendering of Telegram entities (bold, italic, monospace code, URLs, mentions, spoilers);
76
+ - Media attachment indicators (photo, video, document, voice, sticker, poll);
77
+ - Message reactions (👍, 🔥, ❤️);
78
+ - Infinite upward pagination of message history (`PageUp` / `Ctrl+U`);
79
+ - Contextual quick-reply (`Ctrl+R`) and edit (`Ctrl+E`) modes;
80
+ - Modal windows: Help (`F1` / `?`), Chat info (`Ctrl+P`), Action menu (`Ctrl+A`), Send file (`Ctrl+O`).
81
+ - **Standalone CLI mode**:
82
+ - Send messages and files straight from the command line;
83
+ - List dialogs and print chat history in the terminal;
84
+ - Stream live updates.
85
+ - **Sensible configuration**:
86
+ - Credentials and session live in OS user directoriesthe package stays read-only and survives updates;
87
+ - Session and credentials are written with `0600` permissions.
56
88
 
57
89
  ---
58
90
 
59
- ## 📦 Установка
91
+ ## 🖼 Screenshots
92
+
93
+ TuiGram lives in the terminal, so instead of images here are exact text captures of its
94
+ screens. Labels, hints and output formats are taken from the interface code rather than
95
+ invented; the data in the examples is fictional.
96
+
97
+ Note that the interface strings are Russian — the screens below show the client as it
98
+ actually looks today.
99
+
100
+ The main window is shown at the top of this README. Below are the remaining screens.
101
+
102
+ ### Chat search and filtering
103
+
104
+ `/` starts an instant search by title and `@username`; the digits `1`–`6` switch categories
105
+ (All, Direct messages, Groups, Channels, Bots, Unread).
106
+
107
+ ```
108
+ ┌─────────────────────────────────────────────────────────────────────────────────────────────┐
109
+ │ 🚀 TuiGram │ Alex Rivers (@alex_rivers) │ ● В сети │
110
+ ├──────────────────────────────┬──────────────────────────────────────────────────────────────┤
111
+ │ [1:Все] [2:ЛС] [3:Группы] … │ ──────────────── Сегодня ──────────────── │
112
+ │ [/] tech█ │ │
113
+ │ 👥 Tech Chat · Nice work! [3]│ Sam Lee [11:02] │
114
+ │ 📢 Tech Digest · Выпуск… │ Let me know how it goes. │
115
+ │ 🤖 TechSupport Bot · Ок │ │
116
+ │ │ Вы [11:05] ✓✓ │
117
+ │ 3 из 214 чатов │ Will do 👍 │
118
+ │ ├──────────────────────────────────────────────────────────────┤
119
+ │ │ Введите сообщение…█ │
120
+ └──────────────────────────────┴──────────────────────────────────────────────────────────────┘
121
+ ```
122
+
123
+ <details>
124
+ <summary><b>Help — <code>F1</code> / <code>?</code></b></summary>
125
+
126
+ The full list of shortcuts and slash commands, right inside the client.
127
+
128
+ ```
129
+ ┌──────────────────────────────────────────────────────────────────────────┐
130
+ │ 🚀 TuiGram — Горячие клавиши и управление │
131
+ │ │
132
+ │ Навигация и фокус: │
133
+ │ [Tab] / [Shift+Tab] Фокус: Чаты → Сообщения → Ввод │
134
+ │ [↑] / [↓] Перемещение по списку чатов │
135
+ │ [Enter] Открыть чат / Загрузить историю │
136
+ │ [PageUp] / [Ctrl+U] Прокрутка вверх / старая история │
137
+ │ │
138
+ │ Вкладки фильтрации диалогов: │
139
+ │ [1] Все чаты [2] Личные (ЛС) [3] Группы │
140
+ │ [4] Каналы [5] Боты [6] Непрочитанные │
141
+ │ [/] Поиск чатов по названию/username │
142
+ │ │
143
+ │ Работа с сообщениями: │
144
+ │ [Enter] Отправить [Ctrl+R] Ответить (Reply) │
145
+ │ [Ctrl+J] Перенос строки [Ctrl+E] Редактировать сообщение │
146
+ │ [Ctrl+A] Меню действий [Ctrl+O] Отправить файл / фото │
147
+ │ [Ctrl+P] Инфо о чате [Esc] Закрыть окно / режим │
148
+ │ │
149
+ │ Слэш-команды в поле ввода: │
150
+ │ /help /info /sendfile /sendfile <путь> /clear /logout │
151
+ │ │
152
+ │ Выход: │
153
+ │ [Ctrl+Q] или [Ctrl+C] Безопасный выход из клиента │
154
+ │ │
155
+ │ [ Закрыть ] │
156
+ └──────────────────────────────────────────────────────────────────────────┘
157
+ ```
158
+
159
+ </details>
60
160
 
61
- ### Вариант 1: глобальная установка из npm (рекомендуется)
161
+ <details>
162
+ <summary><b>Message action menu — <code>Ctrl+A</code></b></summary>
163
+
164
+ Reply, edit, delete, reactions and attachment download. "Edit" and
165
+ "Download" appear only where they actually apply.
166
+
167
+ ```
168
+ ┌──────────────────────────────────────────────────────┐
169
+ │ ⚡ Действия с сообщением #1042 │
170
+ │ Sam Lee: Have you checked the latest release? │
171
+ ├──────────────────────────────────────────────────────┤
172
+ │ ↩️ Ответить (Reply) │
173
+ │ ✏️ Редактировать текст │
174
+ │ 🗑️ Удалить сообщение │
175
+ │ 👍 Поставить реакцию 👍 │
176
+ │ 🔥 Поставить реакцию 🔥 │
177
+ │ ❤️ Поставить реакцию ❤️ │
178
+ │ 📥 Скачать медиа-вложение │
179
+ │ 📋 Скопировать текст в ввод │
180
+ ├──────────────────────────────────────────────────────┤
181
+ │ [↑↓] Выбор [Enter] Выполнить [Esc] Отмена │
182
+ └──────────────────────────────────────────────────────┘
183
+ ```
184
+
185
+ </details>
186
+
187
+ <details>
188
+ <summary><b>Send file — <code>Ctrl+O</code></b></summary>
189
+
190
+ Several paths separated by `|` are sent as a single album. The line under the
191
+ checkbox states exactly what the file will become on Telegram's side.
192
+
193
+ ```
194
+ ┌────────────────────────────────────────────────────────────┐
195
+ │ 📤 Отправка файла или документа │
196
+ ├────────────────────────────────────────────────────────────┤
197
+ │ Путь к файлу (несколько — через |) [Ctrl+F] Обзор │
198
+ │ ┌────────────────────────────────────────────────────────┐ │
199
+ │ │ ~/Desktop/photo.png | ~/Desktop/chart.png█ │ │
200
+ │ └────────────────────────────────────────────────────────┘ │
201
+ │ Подпись (необязательно): │
202
+ │ ┌────────────────────────────────────────────────────────┐ │
203
+ │ │ Две картинки с релиза │ │
204
+ │ └────────────────────────────────────────────────────────┘ │
205
+ │ [ ] Как файл, без сжатия [Ctrl+D] │
206
+ │ ✓ photo.png · 2.4 MB · уйдёт как фото │
207
+ ├────────────────────────────────────────────────────────────┤
208
+ │ [ Отправить ] [ Отмена ] │
209
+ │ [Tab] Поля [Enter] Далее [Ctrl+F] Обзор [Esc] Выход │
210
+ └────────────────────────────────────────────────────────────┘
211
+ ```
212
+
213
+ </details>
214
+
215
+ <details>
216
+ <summary><b>File browser — <code>Ctrl+F</code></b></summary>
217
+
218
+ Navigate folders with the arrow keys; the size of the highlighted file is shown
219
+ at the bottom.
220
+
221
+ ```
222
+ ┌──────────────────────────────────────────────────────────┐
223
+ │ 📁 Выбор файла: /Users/alex/Desktop │
224
+ ├──────────────────────────────────────────────────────────┤
225
+ │ .. <папка> │
226
+ │ screenshots/ <папка> │
227
+ │ ▸ photo.png 2.4 MB │
228
+ │ chart.png 812 KB │
229
+ │ report.pdf 1.1 MB │
230
+ │ archive.zip 18.7 MB │
231
+ ├──────────────────────────────────────────────────────────┤
232
+ │ photo.png · 2.4 MB │
233
+ │ [↑↓] Навигация [Enter] Выбрать [Esc] Назад │
234
+ └──────────────────────────────────────────────────────────┘
235
+ ```
236
+
237
+ </details>
238
+
239
+ <details>
240
+ <summary><b>Chat info — <code>Ctrl+P</code></b></summary>
241
+
242
+ ID, type, username, member count and description.
243
+
244
+ ```
245
+ ┌──────────────────────────────────────────────────────┐
246
+ │ ℹ Информация о чате │
247
+ ├──────────────────────────────────────────────────────┤
248
+ │ Название: Tech Chat │
249
+ │ Тип: supergroup │
250
+ │ ID: -1001234567890 │
251
+ │ Username: @techchat │
252
+ │ Участников: 1420 │
253
+ │ Уведомления: Включены │
254
+ │ │
255
+ │ О чате / О себе: │
256
+ │ Чат про терминальные клиенты и MTProto. │
257
+ ├──────────────────────────────────────────────────────┤
258
+ │ [ Закрыть ] │
259
+ └──────────────────────────────────────────────────────┘
260
+ ```
261
+
262
+ </details>
263
+
264
+ ### Command line mode
265
+
266
+ <details>
267
+ <summary><b>CLI command output</b></summary>
268
+
269
+ **`tuigram dialogs --limit 8`**
270
+
271
+ ```
272
+ 📂 Загрузка диалогов (макс. 8)...
273
+
274
+ 📌 [user ] Sam Lee id=100200301
275
+ [supergroup] Tech Chat id=-1001234567890 (+3)
276
+ [bot ] Deploy Bot id=100200302
277
+ [channel ] News Channel id=-1009876543210 (+12)
278
+ [saved ] Избранное id=100200300
279
+ [user ] Mia Novak id=100200303 (+1)
280
+ [group ] Team Terminal id=-400112233
281
+ [user ] Nina Ivanova id=100200304
282
+
283
+ Всего получено: 8 диалогов
284
+ ```
285
+
286
+ **`tuigram history @sam_lee --limit 5`**
287
+
288
+ ```
289
+ 💬 Загрузка истории для @sam_lee (макс. 5 сообщений)...
290
+
291
+ [29.08.2026, 11:02:14] #1040 Sam Lee: Let me know how it goes.
292
+ [29.08.2026, 11:05:41] #1041 Вы: Will do 👍
293
+ [29.08.2026, 13:40:07] #1042 Sam Lee: Have you checked the latest release?
294
+ [29.08.2026, 13:41:22] #1043 Sam Lee: 📷 Фото
295
+ [29.08.2026, 13:42:55] #1044 Вы (в ответ на #1042): Yes, testing it right now! (изменено)
296
+
297
+ Всего отображено: 5 сообщений
298
+ ```
299
+
300
+ **`tuigram listen`**
301
+
302
+ ```
303
+ 🟢 Подключено как: Alex Rivers (@alex_rivers)
304
+ Слушаю обновления в реальном времени... Нажмите Ctrl+C для выхода.
305
+
306
+ [13:40:07] + НОВОЕ [-1001234567890] Sam Lee: Have you checked the latest release?
307
+ [13:41:19] ✍️ ПЕЧАТАЕТ чат: -1001234567890
308
+ [13:42:55] + НОВОЕ [-1001234567890] Вы: Yes, testing it right now!
309
+ [13:43:30] ~ ИЗМЕНЕНО [-1001234567890] #1044: Yes, testing it right now! 🚀
310
+ [13:44:02] - УДАЛЕНО [123456789] IDs: 1039, 1038
311
+ ```
312
+
313
+ </details>
314
+
315
+ ---
316
+
317
+ ## 📦 Installation
318
+
319
+ ### Option 1: global install from npm (recommended)
62
320
 
63
321
  ```bash
64
322
  npm install -g @emaxe/tuigram
65
323
  ```
66
324
 
67
- После этого команда `tuigram` доступна в любом каталоге.
325
+ The `tuigram` command is then available from any directory.
68
326
 
69
- ### Вариант 2: разовый запуск без установки
327
+ ### Option 2: one-off run without installing
70
328
 
71
329
  ```bash
72
330
  npx @emaxe/tuigram
73
331
  ```
74
332
 
75
- ### Вариант 3: из исходников (для разработки)
333
+ ### Option 3: from source (for development)
76
334
 
77
335
  ```bash
78
336
  git clone https://github.com/emaxe/tuigram.git
@@ -83,282 +341,321 @@ npm start
83
341
 
84
342
  ---
85
343
 
86
- ## ⚙️ Первый запуск
344
+ ## ⚙️ First run
87
345
 
88
- ### 1. Ключи Telegram API
346
+ ### 1. Telegram API credentials
89
347
 
90
- Получите `api_id` и `api_hash` на [https://my.telegram.org](https://my.telegram.org) (раздел *API development tools*), затем:
348
+ Get your `api_id` and `api_hash` at [https://my.telegram.org](https://my.telegram.org) (*API development tools*), then run:
91
349
 
92
350
  ```bash
93
351
  tuigram init
94
352
  ```
95
353
 
96
- Команда спросит оба ключа и сохранит их с правами `0600`. Для скриптов и CI есть неинтерактивный вариант:
354
+ The command asks for both keys and stores them with `0600` permissions. For scripts and CI there is a non-interactive form:
97
355
 
98
356
  ```bash
99
357
  tuigram init --api-id 1234567 --api-hash 0123456789abcdef0123456789abcdef
100
358
  ```
101
359
 
102
- Альтернатива переменные окружения `TELEGRAM_API_ID` и `TELEGRAM_API_HASH`: они имеют приоритет над файлом настроек.
360
+ Alternatively, use the `TELEGRAM_API_ID` and `TELEGRAM_API_HASH` environment variables they take precedence over the settings file.
103
361
 
104
- ### 2. Авторизация и запуск
362
+ ### 2. Authorization and launch
105
363
 
106
364
  ```bash
107
365
  tuigram
108
366
  ```
109
367
 
110
- При первом запуске TuiGram предложит ввести номер телефона, код подтверждения из Telegram и пароль 2FA (если включён). После этого сессия сохранится, и последующие запуски будут происходить мгновенно.
368
+ On first launch TuiGram asks for your phone number, the confirmation code from Telegram and your 2FA password (if enabled). The session is then saved and subsequent launches are instant.
111
369
 
112
- Отдельно авторизоваться можно командой `tuigram login`.
370
+ You can also authorize separately with `tuigram login`.
113
371
 
114
- > **В неинтерактивной среде** (CI, пайп, `< /dev/null`) вход по телефону невозможен:
115
- > `tuigram login` сразу завершится с понятной ошибкой вместо зависания. Если сессия
116
- > уже есть команда просто сообщит, под кем вы авторизованы, и вернёт код `0`.
117
- > Для автоматизации положите готовый `session.txt` в директорию данных
118
- > (путь подскажет `tuigram paths`).
372
+ > **In a non-interactive environment** (CI, a pipe, `< /dev/null`) phone login is impossible:
373
+ > `tuigram login` exits immediately with a clear error instead of hanging. If a session
374
+ > already exists, the command simply reports who you are signed in as and returns exit
375
+ > code `0`. For automation, drop a ready `session.txt` into the data directory
376
+ > (`tuigram paths` prints the location).
119
377
 
120
378
  ---
121
379
 
122
- ## 📂 Где хранятся файлы
380
+ ## 📂 Where files are stored
123
381
 
124
- Ничего не пишется внутрь самого пакетаэто важно при глобальной установке, где каталог `node_modules` обычно недоступен на запись и стирается при обновлении.
382
+ Nothing is written inside the package itself this matters for global installs, where `node_modules` is usually not writable and is wiped on update.
125
383
 
126
- | Что | macOS / Linux | Windows |
384
+ | What | macOS / Linux | Windows |
127
385
  |---|---|---|
128
- | Настройки (`.env`) | `~/.config/tuigram/.env` | `%APPDATA%\tuigram\.env` |
129
- | Сессия | `~/.local/share/tuigram/session.txt` | `%LOCALAPPDATA%\tuigram\session.txt` |
130
- | Загрузки из чатов | `~/.local/share/tuigram/downloads/` | `%LOCALAPPDATA%\tuigram\downloads\` |
386
+ | Settings (`.env`) | `~/.config/tuigram/.env` | `%APPDATA%\tuigram\.env` |
387
+ | Session | `~/.local/share/tuigram/session.txt` | `%LOCALAPPDATA%\tuigram\session.txt` |
388
+ | Downloads from chats | `~/.local/share/tuigram/downloads/` | `%LOCALAPPDATA%\tuigram\downloads\` |
131
389
 
132
- Посмотреть актуальные пути и состояние конфигурации:
390
+ To inspect the actual paths and configuration state:
133
391
 
134
392
  ```bash
135
393
  tuigram paths
136
394
  ```
137
395
 
138
- Переопределить расположение можно переменными `TUIGRAM_CONFIG_DIR` и `TUIGRAM_DATA_DIR` (учитываются также `XDG_CONFIG_HOME` / `XDG_DATA_HOME`).
396
+ Locations can be overridden with `TUIGRAM_CONFIG_DIR` and `TUIGRAM_DATA_DIR` (`XDG_CONFIG_HOME` / `XDG_DATA_HOME` are honored too).
139
397
 
140
- **Приоритет настроек** (сверху вниз, первое найденное выигрывает):
141
- 1. переменные окружения процесса;
142
- 2. `.env` в корне проектатолько при запуске из клона репозитория;
143
- 3. `~/.config/tuigram/.env` — основной файл установленного CLI.
398
+ **Settings precedence** (top to bottom, first match wins):
399
+ 1. process environment variables;
400
+ 2. `.env` in the project root only when running from a repository clone;
401
+ 3. `~/.config/tuigram/.env` — the main file for an installed CLI.
144
402
 
145
- Сессия из старых установок (`<проект>/data/session.txt`) переносится в новое расположение автоматически при первом запускеповторно логиниться не нужно.
403
+ A session from an older installation (`<project>/data/session.txt`) is migrated to the new location automatically on first run no need to log in again.
146
404
 
147
405
  ---
148
406
 
149
- ## 🛠 Разработка
407
+ ## 🛠 Development
150
408
 
151
- При запуске из клона репозитория работает интерактивное меню-диспетчер:
409
+ When running from a repository clone, an interactive launcher menu is available:
152
410
 
153
411
  ```bash
154
- ./run.sh # или npm run menu
412
+ ./run.sh # or npm run menu
155
413
  ```
156
414
 
157
- Оно даёт удобный выбор режима (TUI, логин, диалоги, отправка, тесты, очистка).
415
+ It offers a convenient choice of mode (TUI, login, dialogs, send, tests, cleanup).
158
416
 
159
- Тесты и проверка содержимого будущего npm-пакета:
417
+ Tests and a check of the future npm package contents:
160
418
 
161
419
  ```bash
162
- npm test # юнит-тесты
163
- node scripts/check-package.js # проверка, что в пакет не утекают .env и сессия
420
+ npm test # unit tests
421
+ node scripts/check-package.js # verifies that .env and the session do not leak into the package
164
422
  ```
165
423
 
166
424
  ---
167
425
 
168
- ## ⌨️ Горячие клавиши
426
+ ## ⌨️ Keyboard shortcuts
169
427
 
170
- | Сочетание клавиш | Область | Действие |
428
+ | Shortcut | Scope | Action |
171
429
  |---|---|---|
172
- | `Tab` / `Shift+Tab` | Глобально | Фокус по кругу: Список диалогов Лента сообщенийПоле ввода |
173
- | `↑` / `↓` | Список диалогов | Выбор чата |
174
- | `Enter` | Список диалогов | Открыть выбранный чат и загрузить историю |
175
- | `1` .. `6` | Список диалогов | Переключение категорий: `1:Все`, `2:ЛС`, `3:Группы`, `4:Каналы`, `5:Боты`, `6:Непроч` |
176
- | `/` | Список диалогов | Поиск / фильтрация чатов |
177
- | `Enter` | Поле ввода | Отправить набранное сообщение |
178
- | `Ctrl+J` | Поле ввода | Перенос строки без отправки |
179
- | `Ctrl+R` | Чат / Ввод | Ответить (Reply) на последнее сообщение |
180
- | `Ctrl+E` | Чат / Ввод | Редактировать своё последнее сообщение |
181
- | `Ctrl+A` | Сообщения | Контекстное меню действий (Реакции, Удаление, Скачивание, Ответ) |
182
- | `Ctrl+O` | Глобально | Отправить файл / фото / документ |
183
- | `Ctrl+F` | Окно отправки | Обзор файлов (навигация по папкам) |
184
- | `Ctrl+D` | Окно отправки | Отправить без сжатия, документом |
185
- | `Ctrl+P` | Глобально | Информация о текущем чате (ID, участники, ссылки) |
186
- | `PageUp` / `Ctrl+U`| История | Прокрутка вверх / подгрузка старой истории |
187
- | `PageDown` / `Ctrl+D`| История | Прокрутка вниз |
188
- | `Esc` | Модальные окна | Закрыть модальное окно / отменить Reply/Edit |
189
- | `F1` или `?` | Глобально | Окно справки со всеми горячими клавишами |
190
- | `Ctrl+Q` / `Ctrl+C` | Глобально | Безопасный выход из клиента |
430
+ | `Tab` / `Shift+Tab` | Global | Cycle focus: dialog listmessage feedinput box |
431
+ | `↑` / `↓` | Dialog list | Select a chat |
432
+ | `Enter` | Dialog list | Open the selected chat and load its history |
433
+ | `1` .. `6` | Dialog list | Switch category: `1:All`, `2:DM`, `3:Groups`, `4:Channels`, `5:Bots`, `6:Unread` |
434
+ | `/` | Dialog list | Search / filter chats |
435
+ | `Enter` | Input box | Send the typed message |
436
+ | `Ctrl+J` | Input box | Insert a line break without sending |
437
+ | `Ctrl+R` | Chat / Input | Reply to the last message |
438
+ | `Ctrl+E` | Chat / Input | Edit your own last message |
439
+ | `Ctrl+A` | Messages | Context action menu (reactions, delete, download, reply) |
440
+ | `Ctrl+O` | Global | Send a file / photo / document |
441
+ | `Ctrl+F` | Send dialog | File browser (navigate folders) |
442
+ | `Ctrl+D` | Send dialog | Send uncompressed, as a document |
443
+ | `Ctrl+P` | Global | Info about the current chat (ID, members, links) |
444
+ | `PageUp` / `Ctrl+U` | History | Scroll up / load older history |
445
+ | `PageDown` / `Ctrl+D` | History | Scroll down |
446
+ | `Esc` | Modals | Close the modal / cancel reply or edit |
447
+ | `F1` or `?` | Global | Help window with every shortcut |
448
+ | `Ctrl+Q` / `Ctrl+C` | Global | Safely exit the client |
191
449
 
192
450
  ---
193
451
 
194
- ## 💬 Слэш-команды в поле ввода
452
+ ## 💬 Slash commands in the input box
195
453
 
196
- В поле ввода сообщения доступны быстрые команды (начинаются с `/`):
454
+ Quick commands are available in the message input box (they start with `/`):
197
455
 
198
- - `/help` — открыть окно помощи;
199
- - `/info` — подробная информация о текущем чате;
200
- - `/sendfile` — открыть окно отправки файла;
201
- - `/sendfile <путь>`отправить файл сразу;
202
- - `/sendfile <путь> -- <подпись>`файл с подписью;
203
- - `/sendfile <путь> | <путь> -- <подпись>`альбом из нескольких файлов;
204
- - `/clear` — очистить экранную ленту сообщений;
205
- - `/logout` — выйти из аккаунта Telegram.
456
+ - `/help` — open the help window;
457
+ - `/info` — detailed information about the current chat;
458
+ - `/sendfile` — open the send-file dialog;
459
+ - `/sendfile <path>`send a file right away;
460
+ - `/sendfile <path> -- <caption>`file with a caption;
461
+ - `/sendfile <path> | <path> -- <caption>`an album of several files;
462
+ - `/clear` — clear the on-screen message feed;
463
+ - `/logout` — sign out of the Telegram account.
206
464
 
207
465
  ---
208
466
 
209
- ## 📎 Отправка файлов и картинок
467
+ ## 📎 Sending files and images
210
468
 
211
- Три способа: окно `Ctrl+O`, слэш-команда `/sendfile`, консольная команда `sendfile`.
469
+ Three ways: the `Ctrl+O` dialog, the `/sendfile` slash command, and the `sendfile` console command.
212
470
 
213
- **Окно отправки (`Ctrl+O`)**
471
+ **The send dialog (`Ctrl+O`)**
214
472
 
215
- - `Ctrl+F` — обзор файлов: навигация по папкам стрелками, `Enter` войти в папку или выбрать файл, `Esc` назад. Внизу показывается размер подсвеченного файла.
216
- - Путь можно и просто ввести: понимает `~/Desktop/foto.png`, пути в кавычках и с экранированными пробеламито есть перетаскивание файла прямо в терминал работает.
217
- - Несколько файловчерез `|` в поле пути (или добавляйте их по одному через обзор). До 10 штук уходят одним альбомом.
218
- - `Ctrl+D` — отправить без сжатия, документом. Полезно, когда важно исходное качество картинки.
219
- - Строка под чекбоксом сразу показывает, что именно уйдёт: `✓ photo.png · 2.4 MB · уйдёт как фото`.
220
- - Если в этот момент активен режим ответа (`Ctrl+R`), файл уйдёт **ответом** на сообщение.
473
+ - `Ctrl+F` — file browser: navigate folders with the arrow keys, `Enter` enters a folder or picks a file, `Esc` goes back. The size of the highlighted file is shown at the bottom.
474
+ - You can also just type a path: `~/Desktop/photo.png`, quoted paths and escaped spaces are understoodso dragging a file into the terminal works.
475
+ - Multiple filesseparate them with `|` in the path field (or add them one by one via the browser). Up to 10 are sent as a single album.
476
+ - `Ctrl+D` — send uncompressed, as a document. Useful when the original image quality matters.
477
+ - The line under the checkbox shows exactly what will be sent: `✓ photo.png · 2.4 MB · will be sent as a photo`.
478
+ - If reply mode (`Ctrl+R`) is active at that moment, the file is sent **as a reply** to that message.
221
479
 
222
- **Что уходит фото, а что документом**
480
+ **What goes as a photo and what as a document**
223
481
 
224
- `.png`, `.jpg`, `.jpeg` Telegram принимает как сжатое фото; видеоформаты (`.mp4`, `.mov`, `.mkv` и т.п.) как видео; всё остальное, включая `.webp` и `.heic`, документом. Флажок «Как файл, без сжатия» (`Ctrl+D`, в CLI — `--as-file`) заставляет отправить документом что угодно.
482
+ Telegram accepts `.png`, `.jpg`, `.jpeg` as compressed photos; video formats (`.mp4`, `.mov`, `.mkv`, etc.) as video; everything else, including `.webp` and `.heic`, as a document. The "As a file, uncompressed" checkbox (`Ctrl+D`, or `--as-file` in the CLI) forces anything to be sent as a document.
225
483
 
226
- **Прогресс и отмена**
484
+ **Progress and cancellation**
227
485
 
228
- Во время загрузки в строке состояния идут проценты. `Esc` прерывает отправку.
486
+ The status bar shows a percentage during upload. `Esc` aborts the transfer.
229
487
 
230
- **Скачивание входящих**
488
+ **Downloading incoming media**
231
489
 
232
- `Ctrl+A` на сообщении«Скачать медиа-вложение». Файл сохранится в `data/downloads/`.
490
+ `Ctrl+A` on a message "Download attachment". The file is saved to the downloads directory.
233
491
 
234
492
  ---
235
493
 
236
- ## 🎨 Темы оформления
494
+ ## 🎨 Themes
237
495
 
238
- Тема задаётся в `.env`:
496
+ The theme is set in `.env`:
239
497
 
240
498
  ```env
241
- TUI_THEME=default # тёмная (по умолчанию)
499
+ TUI_THEME=default # dark (default)
242
500
  TUI_THEME=nord # Nord
243
- TUI_THEME=light # светлая
501
+ TUI_THEME=light # light
244
502
  ```
245
503
 
246
- Все цвета заданы hex-значениями и сводятся к палитре xterm-256 (индексы ≥ 16).
247
- Именованные цвета (`blue`, `cyan`, `gray`) специально не используются: они
248
- занимают индексы 0–15, которые тема терминала перекрашивает по-своемуиз-за
249
- этого синий фон мог рисоваться бирюзовым, а серый текст пропадать совсем.
504
+ All colors are given as hex values and are reduced to the xterm-256 palette (indices ≥ 16).
505
+ Named colors (`blue`, `cyan`, `gray`) are deliberately avoided: they occupy indices 0–15,
506
+ which the terminal theme repaints as it pleasesthat is why a blue background could render
507
+ as teal and gray text could disappear entirely.
250
508
 
251
- Контраст каждой пары «текст на фоне» проверяется автотестом по WCAG (порог 3:1)
252
- уже **после** конверсии в xterm-256, то есть ровно в том виде, в каком цвет
253
- увидит пользователь.
509
+ The contrast of every "text on background" pair is verified by an automated WCAG test
510
+ (threshold 3:1) **after** conversion to xterm-256 that is, exactly as the user will see it.
254
511
 
255
512
  ---
256
513
 
257
- ## 🛠️ Использование через консоль (CLI)
514
+ ## 🛠️ Command line usage (CLI)
258
515
 
259
- TuiGram можно запускать в режиме консольных утилит (при запуске из клона
260
- репозитория подставьте `node bin/tuigram.js` вместо `tuigram`):
516
+ TuiGram can be used as a set of console utilities (when running from a repository
517
+ clone, substitute `node bin/tuigram.js` for `tuigram`):
261
518
 
262
519
  ```bash
263
- # Авторизация
520
+ # Authorization
264
521
  tuigram login
265
522
 
266
- # Список диалогов
523
+ # List dialogs
267
524
  tuigram dialogs --limit 30
268
525
 
269
- # Просмотр истории чата (@username, ID или me для «Избранного»)
270
- tuigram history @durov --limit 20
526
+ # View chat history (@username, ID, or `me` for Saved Messages)
527
+ tuigram history @sam_lee --limit 20
271
528
  tuigram history me
272
529
 
273
- # Отправка текстового сообщения
274
- tuigram send me "Привет из терминала!"
275
- tuigram send @friend "Встречаемся в 18:00"
530
+ # Send a text message
531
+ tuigram send me "Hello from the terminal!"
532
+ tuigram send @friend "See you at 18:00"
276
533
 
277
- # Отправка файла (несколько путей уходят одним альбомом)
534
+ # Send a file (multiple paths are sent as one album)
278
535
  tuigram sendfile me ./screenshot.png
279
- tuigram sendfile me ~/a.png ~/b.png --caption "Две картинки"
280
- tuigram sendfile me ~/photo.png --as-file # без сжатия, документом
536
+ tuigram sendfile me ~/a.png ~/b.png --caption "Two pictures"
537
+ tuigram sendfile me ~/photo.png --as-file # uncompressed, as a document
281
538
 
282
- # Живой стрим обновлений в реальном времени
539
+ # Live stream of real-time updates
283
540
  tuigram listen
284
541
  ```
285
542
 
286
543
  ---
287
544
 
288
- ## 📁 Структура проекта
545
+ ## 📁 Project structure
289
546
 
290
547
  ```
291
548
  TuiGram/
292
549
  ├── bin/
293
- │ └── tuigram.js # CLI исполняемый файл
550
+ │ └── tuigram.js # CLI executable
294
551
  ├── src/
295
- │ ├── index.js # Главная точка входа (TUI / CLI роутер)
296
- │ ├── config.js # Пути пользовательских директорий и загрузчик .env
297
- │ ├── state.js # Реактивное централизованное хранилище состояния
552
+ │ ├── index.js # Main entry point (TUI / CLI router)
553
+ │ ├── config.js # User directory paths and .env loader
554
+ │ ├── state.js # Reactive centralized state store
298
555
  │ ├── telegram/
299
- │ │ ├── client.js # Создание и управление MTProto клиентом
300
- │ │ ├── auth.js # Интерактивный логин-визард и 2FA
301
- │ │ ├── dialogs.js # Получение, фильтрация и поиск диалогов
302
- │ │ ├── messages.js # Загрузка истории, отправка, правка, файлы, реакции
303
- │ │ ├── listener.js # Живой фоновый слушатель событий MTProto
304
- │ │ ├── entities.js # Парсинг пиров, типы чатов и кэш сущностей
305
- │ │ └── formatter.js # Telegram Entities -> Blessed ANSI форматирование
556
+ │ │ ├── client.js # MTProto client creation and management
557
+ │ │ ├── auth.js # Interactive login wizard and 2FA
558
+ │ │ ├── dialogs.js # Fetching, filtering and searching dialogs
559
+ │ │ ├── messages.js # History loading, sending, editing, files, reactions
560
+ │ │ ├── listener.js # Live background MTProto event listener
561
+ │ │ ├── entities.js # Peer parsing, chat types and entity cache
562
+ │ │ └── formatter.js # Telegram entities -> Blessed ANSI formatting
306
563
  │ ├── ui/
307
- │ │ ├── screen.js # Управление Blessed Screen
308
- │ │ ├── theme.js # Темы оформления (Default Dark, Nord, Light)
309
- │ │ ├── app.js # Главный координатор интерфейса
564
+ │ │ ├── screen.js # Blessed screen management
565
+ │ │ ├── theme.js # Themes (Default Dark, Nord, Light)
566
+ │ │ ├── app.js # Main interface coordinator
310
567
  │ │ └── components/
311
- │ │ ├── header.js # Верхняя шапка и статус подключения
312
- │ │ ├── chatList.js # Список диалогов со скроллом, табами и поиском
313
- │ │ ├── chatView.js # Лента сообщений с автоскроллом и форматированием
314
- │ │ ├── inputBox.js # Поле ввода с плашкой Reply/Edit и историей
315
- │ │ ├── statusBar.js # Нижняя строка подсказок и тостов
568
+ │ │ ├── header.js # Top header and connection status
569
+ │ │ ├── chatList.js # Dialog list with scrolling, tabs and search
570
+ │ │ ├── chatView.js # Message feed with autoscroll and formatting
571
+ │ │ ├── inputBox.js # Input box with reply/edit banner and history
572
+ │ │ ├── statusBar.js # Bottom hint line and toasts
316
573
  │ │ └── modals/
317
- │ │ ├── helpModal.js # Окно справки
318
- │ │ ├── chatInfoModal.js # Окно информации о чате
319
- │ │ ├── actionModal.js # Меню действий с сообщением
320
- │ │ ├── fileModal.js # Диалог отправки файла
321
- │ │ └── confirmModal.js # Диалог подтверждения
574
+ │ │ ├── helpModal.js # Help window
575
+ │ │ ├── chatInfoModal.js # Chat info window
576
+ │ │ ├── actionModal.js # Message action menu
577
+ │ │ ├── fileModal.js # Send-file dialog
578
+ │ │ └── confirmModal.js # Confirmation dialog
322
579
  │ ├── cli/
323
- │ │ ├── cliCommands.js # Автономные CLI команды
324
- │ │ ├── init.js # tuigram init / paths — настройка и диагностика
325
- │ │ └── formatters.js # Консольные форматтеры таблиц и логов
580
+ │ │ ├── cliCommands.js # Standalone CLI commands
581
+ │ │ ├── init.js # tuigram init / paths — setup and diagnostics
582
+ │ │ └── formatters.js # Console table and log formatters
326
583
  │ └── utils/
327
- │ ├── storage.js # Файловые операции и сохранение сессий
328
- │ └── time.js # Форматирование времени и дат
584
+ │ ├── storage.js # File operations and session persistence
585
+ │ └── time.js # Time and date formatting
329
586
  ├── scripts/
330
- │ └── check-package.js # Предпубликационная проверка npm-пакета
587
+ │ └── check-package.js # Pre-publish npm package check
331
588
  ├── test/
332
- │ └── unit.test.js # Юнит-тесты
333
- ├── .env.example # Пример конфигурации
334
- ├── run.sh # Меню-диспетчер для разработки
589
+ │ └── unit.test.js # Unit tests
590
+ ├── .env.example # Configuration example
591
+ ├── run.sh # Development launcher menu
592
+ ├── AGENTS.md # Codebase rules (source of truth for AI agents)
593
+ ├── CHANGELOG.md
335
594
  ├── LICENSE
336
595
  ├── package.json
337
- └── README.md
596
+ ├── README.md
597
+ └── README.ru.md
338
598
  ```
339
599
 
340
- > В опубликованный npm-пакет попадают только `bin/`, `src/`, `README.md`, `LICENSE`
341
- > и `.env.example` — см. поле `files` в `package.json`.
600
+ > The published npm package contains only `bin/`, `src/`, `README.md`, `README.ru.md`,
601
+ > `CHANGELOG.md`, `LICENSE` and `.env.example` — see the `files` field in `package.json`.
602
+
603
+ ---
604
+
605
+ ## 🔒 Security
606
+
607
+ **Where the authorization lives.** A single file — `session.txt` in the data directory
608
+ (`~/.local/share/tuigram/` or `%LOCALAPPDATA%\tuigram\`; the location can be changed with
609
+ `TUIGRAM_DATA_DIR` and inspected with `tuigram paths`). It holds an MTProto `StringSession`:
610
+ the format version, the data-center number, its address and port, and a 256-byte `authKey`,
611
+ base64-encoded. Neither your password nor the confirmation code is stored there.
612
+
613
+ - The session file and the settings file are written with `0600` permissions — owner read/write only.
614
+ - Neither the session nor the credentials live inside the package: `npm update` does not touch them.
615
+ - `data/` and `.env` are in `.gitignore` and excluded from the npm package via the `files` field;
616
+ `node scripts/check-package.js` fails if a secret ends up in the build anyway.
617
+ - **The `authKey` is stored in the clear**: base64 is an encoding, not encryption.
618
+ Anyone who reads the file gets full access to the account without the phone, the code or 2FA.
619
+ Do not put it in shared folders or unencrypted backups. If the file leaks,
620
+ terminate the session in an official client (*Settings → Devices*) — that revokes the key
621
+ on the server and makes the string useless.
622
+ - `/logout` in the TUI revokes the key on the server and deletes the session file.
623
+ - No data is sent to third-party servers — the client connects directly to the official
624
+ Telegram MTProto servers.
342
625
 
343
626
  ---
344
627
 
345
- ## 🔒 Безопасность
346
-
347
- **Где лежит авторизация.** Единственный файл `session.txt` в директории данных
348
- (`~/.local/share/tuigram/` или `%LOCALAPPDATA%\tuigram\`; путь можно сменить через
349
- `TUIGRAM_DATA_DIR`, посмотреть командой `tuigram paths`). Внутри строка
350
- `StringSession` от MTProto: версия формата, номер дата-центра, его адрес и порт,
351
- и 256-байтный `authKey`, закодированные в base64. Пароля и кода подтверждения там нет.
352
-
353
- - Файл сессии и файл настроек сохраняются с правами `0600` — чтение и запись только владельцу.
354
- - Ни сессия, ни ключи не лежат внутри пакета: `npm update` их не затрагивает.
355
- - `data/` и `.env` в `.gitignore` и исключены из npm-пакета полем `files`;
356
- проверка `node scripts/check-package.js` падает, если секрет всё же попал в сборку.
357
- - **`authKey` хранится в открытом виде**: base64 — это кодирование, а не шифрование.
358
- Кто прочитает файл, тот получит полный доступ к аккаунту без телефона, кода и 2FA.
359
- Не кладите его в общие папки и незашифрованные бэкапы. Если файл утёк —
360
- завершите сеанс в официальном клиенте («Настройки → Устройства»), это отзовёт ключ
361
- на сервере, и строка станет бесполезной.
362
- - `/logout` в TUI отзывает ключ на сервере и удаляет файл сессии.
363
- - Никакие данные не передаются сторонним серверам — прямое соединение с официальными
364
- серверами Telegram MTProto.
628
+ ## 📜 Changelog
629
+
630
+ All notable changes are recorded in [CHANGELOG.md](./CHANGELOG.md).
631
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
632
+ and versioning follows [SemVer](https://semver.org/).
633
+
634
+ ---
635
+
636
+ ## 🤝 Contributing
637
+
638
+ Bug reports and pull requests are welcome:
639
+ [issues](https://github.com/emaxe/tuigram/issues).
640
+
641
+ Before submitting changes:
642
+
643
+ ```bash
644
+ npm test # unit tests must be green
645
+ node scripts/check-package.js # .env and the session must not reach the package
646
+ ```
647
+
648
+ Codebase rules for humans and AI agents live in [AGENTS.md](./AGENTS.md) — the single
649
+ source of truth for architecture, style, testing and security. If you work with
650
+ Claude Code, Cursor or Copilot, start there.
651
+
652
+ Both README versions (`README.md` and `README.ru.md`) must be updated together.
653
+
654
+ ---
655
+
656
+ ## 📄 License
657
+
658
+ [MIT](./LICENSE) © Maksim Klisin
659
+
660
+ TuiGram is an unofficial client. The project is not affiliated with,
661
+ nor endorsed by, Telegram Messenger Inc.