agent-telegram 0.5.0 → 0.6.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 +141 -112
- package/bin/run.js +0 -0
- package/binaries/agent-telegram-darwin-amd64 +0 -0
- package/binaries/agent-telegram-darwin-arm64 +0 -0
- package/binaries/agent-telegram-linux-amd64 +0 -0
- package/binaries/agent-telegram-linux-arm64 +0 -0
- package/binaries/agent-telegram-windows-amd64.exe +0 -0
- package/binaries/agent-telegram-windows-arm64.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ agent-telegram login # Interactive login
|
|
|
30
30
|
agent-telegram my-info # Get your profile
|
|
31
31
|
agent-telegram chat list # List all chats
|
|
32
32
|
agent-telegram chat open @username # View messages from chat
|
|
33
|
-
agent-telegram send
|
|
33
|
+
agent-telegram send @user "Hello!" # Send message
|
|
34
34
|
agent-telegram stop # Stop server
|
|
35
35
|
```
|
|
36
36
|
|
|
@@ -43,41 +43,66 @@ agent-telegram login # Interactive login
|
|
|
43
43
|
agent-telegram logout # Logout and clear session
|
|
44
44
|
agent-telegram my-info # Get your profile information
|
|
45
45
|
agent-telegram llms-txt # Generate full CLI documentation for LLMs
|
|
46
|
-
|
|
47
46
|
```
|
|
48
47
|
|
|
49
48
|
### Send Messages
|
|
50
49
|
|
|
50
|
+
Supports both subcommands and flags for backward compatibility:
|
|
51
|
+
|
|
51
52
|
```bash
|
|
52
|
-
|
|
53
|
-
agent-telegram send
|
|
54
|
-
agent-telegram send
|
|
55
|
-
agent-telegram send
|
|
56
|
-
agent-telegram send
|
|
57
|
-
agent-telegram send
|
|
58
|
-
agent-telegram send
|
|
59
|
-
agent-telegram send
|
|
60
|
-
agent-telegram send
|
|
61
|
-
agent-telegram send
|
|
62
|
-
agent-telegram send
|
|
63
|
-
agent-telegram send
|
|
64
|
-
|
|
53
|
+
# Subcommands (recommended)
|
|
54
|
+
agent-telegram send text @user "Hello!" # Text message
|
|
55
|
+
agent-telegram send photo @user image.png # Photo
|
|
56
|
+
agent-telegram send photo @user image.png --caption "Nice" # Photo with caption
|
|
57
|
+
agent-telegram send video @user video.mp4 # Video
|
|
58
|
+
agent-telegram send voice @user voice.ogg # Voice message
|
|
59
|
+
agent-telegram send sticker @user file.webp # Sticker
|
|
60
|
+
agent-telegram send dice @user # Dice (random value)
|
|
61
|
+
agent-telegram send dice @user --emoticon 🎯 # Dice with emoticon
|
|
62
|
+
agent-telegram send poll @user "Question?" --option A --option B # Poll
|
|
63
|
+
agent-telegram send location @user --lat 55.75 --long 37.61 # Location
|
|
64
|
+
agent-telegram send contact @user --phone "+123" --first-name Jo # Contact
|
|
65
|
+
|
|
66
|
+
# Flag syntax (still works)
|
|
67
|
+
agent-telegram send --to @user "text"
|
|
68
|
+
agent-telegram send --to @user --photo image.png
|
|
69
|
+
agent-telegram send --to @user --video video.mp4
|
|
70
|
+
agent-telegram send --to @user --voice voice.ogg
|
|
71
|
+
agent-telegram send --to @user --video-note vid.mp4
|
|
72
|
+
agent-telegram send --to @user --sticker file.webp
|
|
73
|
+
agent-telegram send --to @user --gif anim.mp4
|
|
74
|
+
agent-telegram send --to @user --document file.pdf
|
|
75
|
+
agent-telegram send --to @user --audio music.mp3
|
|
76
|
+
agent-telegram send --to @user --dice
|
|
77
|
+
agent-telegram send --to @user --contact "+1234567890" --first-name "John"
|
|
78
|
+
agent-telegram send --to @user --reply-to 123 "Reply text"
|
|
79
|
+
agent-telegram send --to @user --poll "Question?" --option "Yes" --option "No"
|
|
80
|
+
agent-telegram send --to @user --latitude 55.7558 --longitude 37.6173
|
|
81
|
+
|
|
82
|
+
# Pipe support
|
|
83
|
+
echo "Hello from pipe" | agent-telegram send @user
|
|
65
84
|
```
|
|
66
85
|
|
|
67
86
|
### Message Management (`msg`)
|
|
68
87
|
|
|
69
88
|
```bash
|
|
70
|
-
agent-telegram msg
|
|
71
|
-
agent-telegram msg
|
|
72
|
-
agent-telegram msg
|
|
73
|
-
agent-telegram msg
|
|
74
|
-
agent-telegram msg
|
|
75
|
-
agent-telegram msg
|
|
76
|
-
agent-telegram msg
|
|
77
|
-
agent-telegram msg
|
|
78
|
-
agent-telegram msg
|
|
79
|
-
agent-telegram msg
|
|
80
|
-
agent-telegram msg
|
|
89
|
+
agent-telegram msg list @user # List messages
|
|
90
|
+
agent-telegram msg list @user --output ids # List message IDs only (pipe-friendly)
|
|
91
|
+
agent-telegram msg read --to @user # Mark messages as read
|
|
92
|
+
agent-telegram msg typing --to @user # Send typing indicator
|
|
93
|
+
agent-telegram msg scheduled --to @user # List scheduled messages
|
|
94
|
+
agent-telegram msg delete --to @user 123 # Delete message by ID
|
|
95
|
+
agent-telegram msg delete --to @user 1,2,3 # Delete multiple messages
|
|
96
|
+
agent-telegram msg forward 123 --from @user --to @other # Forward message
|
|
97
|
+
agent-telegram msg pin 123 --to @user # Pin message
|
|
98
|
+
agent-telegram msg pin 123 --to @user --unpin # Unpin message
|
|
99
|
+
agent-telegram msg reaction 123 "👍" --to @user # Add reaction
|
|
100
|
+
agent-telegram msg inspect-buttons 123 --to @user # View inline buttons
|
|
101
|
+
agent-telegram msg press-button 123 0 --to @user # Press button
|
|
102
|
+
agent-telegram msg inspect-keyboard --to @user # View reply keyboard
|
|
103
|
+
agent-telegram msg clear --to @user 123,456 # Clear specific messages
|
|
104
|
+
agent-telegram msg clear --to @user --history # Clear entire history
|
|
105
|
+
agent-telegram msg clear --to @user --history --revoke # Clear history for both sides
|
|
81
106
|
```
|
|
82
107
|
|
|
83
108
|
### Chat Management (`chat`)
|
|
@@ -85,72 +110,67 @@ agent-telegram msg inspect-keyboard @user # View reply keyboard
|
|
|
85
110
|
```bash
|
|
86
111
|
agent-telegram chat list # List all chats
|
|
87
112
|
agent-telegram chat list -l 50 # List with limit
|
|
88
|
-
agent-telegram chat info @channel
|
|
113
|
+
agent-telegram chat info --to @channel # Get chat information
|
|
89
114
|
agent-telegram chat open @user # View messages
|
|
90
115
|
agent-telegram chat open @user -l 50 # View 50 messages
|
|
91
116
|
agent-telegram chat open @user -l 50 -o 100 # With offset
|
|
92
|
-
agent-telegram chat create-group "Name" @user1
|
|
93
|
-
agent-telegram chat create-channel "Name" "
|
|
94
|
-
agent-telegram chat join https://t.me/+invite
|
|
95
|
-
agent-telegram chat subscribe @channel
|
|
96
|
-
agent-telegram chat leave @group
|
|
97
|
-
agent-telegram chat invite @group @user
|
|
98
|
-
agent-telegram chat edit-title @group "New Title"
|
|
99
|
-
agent-telegram chat set-photo @group photo.jpg
|
|
100
|
-
agent-telegram chat delete-photo @group
|
|
101
|
-
agent-telegram chat pin @group
|
|
102
|
-
agent-telegram chat
|
|
103
|
-
agent-telegram chat
|
|
104
|
-
agent-telegram chat
|
|
105
|
-
agent-telegram chat
|
|
106
|
-
agent-telegram chat archive @group --unarchive # Unarchive
|
|
107
|
-
agent-telegram chat topics @forum # List forum topics
|
|
108
|
-
agent-telegram chat invite-link @group # Get/create invite link
|
|
117
|
+
agent-telegram chat create-group "Name" --members @user1,@user2 # Create group
|
|
118
|
+
agent-telegram chat create-channel "Name" --description "Desc" # Create channel
|
|
119
|
+
agent-telegram chat join --link https://t.me/+invite # Join via link
|
|
120
|
+
agent-telegram chat subscribe --channel @channel # Subscribe to channel
|
|
121
|
+
agent-telegram chat leave --to @group # Leave chat/channel
|
|
122
|
+
agent-telegram chat invite --to @group --user @user # Invite user
|
|
123
|
+
agent-telegram chat edit-title --to @group --title "New Title" # Edit title
|
|
124
|
+
agent-telegram chat set-photo --to @group --file photo.jpg # Set photo
|
|
125
|
+
agent-telegram chat delete-photo --to @group # Delete photo
|
|
126
|
+
agent-telegram chat pin --to @group # Pin chat in list
|
|
127
|
+
agent-telegram chat mute --to @group # Mute notifications
|
|
128
|
+
agent-telegram chat archive --to @group # Archive chat
|
|
129
|
+
agent-telegram chat topics --to @forum # List forum topics
|
|
130
|
+
agent-telegram chat invite-link --to @group # Get/create invite link
|
|
109
131
|
```
|
|
110
132
|
|
|
111
133
|
### Members & Admins
|
|
112
134
|
|
|
113
135
|
```bash
|
|
114
|
-
agent-telegram chat participants @group # List members
|
|
115
|
-
agent-telegram chat admins @group # List admins
|
|
116
|
-
agent-telegram chat banned @group # List banned users
|
|
117
|
-
agent-telegram chat promote-admin @group @user # Promote to admin
|
|
118
|
-
agent-telegram chat demote-admin @group @user # Demote admin
|
|
119
|
-
agent-telegram chat slow-mode @group 30
|
|
120
|
-
agent-telegram chat permissions @group # Set
|
|
136
|
+
agent-telegram chat participants --to @group # List members
|
|
137
|
+
agent-telegram chat admins --to @group # List admins
|
|
138
|
+
agent-telegram chat banned --to @group # List banned users
|
|
139
|
+
agent-telegram chat promote-admin --to @group --user @user # Promote to admin
|
|
140
|
+
agent-telegram chat demote-admin --to @group --user @user # Demote admin
|
|
141
|
+
agent-telegram chat slow-mode --to @group --seconds 30 # Set slow mode
|
|
142
|
+
agent-telegram chat permissions --to @group --send-messages # Set permissions
|
|
121
143
|
```
|
|
122
144
|
|
|
123
145
|
### Contacts (`contact`)
|
|
124
146
|
|
|
125
147
|
```bash
|
|
126
148
|
agent-telegram contact list # List contacts
|
|
127
|
-
agent-telegram contact add "+1234567890" "John" "Doe"
|
|
128
|
-
agent-telegram contact delete @user
|
|
149
|
+
agent-telegram contact add --phone "+1234567890" --first-name "John" --last-name "Doe"
|
|
150
|
+
agent-telegram contact delete --user @user
|
|
129
151
|
```
|
|
130
152
|
|
|
131
153
|
### User (`user`)
|
|
132
154
|
|
|
133
155
|
```bash
|
|
134
156
|
agent-telegram user info @user # Get user info
|
|
135
|
-
agent-telegram user ban @user
|
|
136
|
-
agent-telegram user ban @user
|
|
137
|
-
agent-telegram user mute @user # Mute user
|
|
138
|
-
agent-telegram user mute @user --unmute # Unmute user
|
|
157
|
+
agent-telegram user ban --to @user # Block user
|
|
158
|
+
agent-telegram user ban --to @user -d # Unblock user
|
|
139
159
|
```
|
|
140
160
|
|
|
141
161
|
### Folders (`folders`)
|
|
142
162
|
|
|
143
163
|
```bash
|
|
144
164
|
agent-telegram folders list # List chat folders
|
|
145
|
-
agent-telegram folders create "Work"
|
|
146
|
-
agent-telegram folders delete 1
|
|
165
|
+
agent-telegram folders create --title "Work" --include-groups # Create folder
|
|
166
|
+
agent-telegram folders delete --id 1 # Delete folder by ID
|
|
147
167
|
```
|
|
148
168
|
|
|
149
169
|
### Privacy (`privacy`)
|
|
150
170
|
|
|
151
171
|
```bash
|
|
152
|
-
agent-telegram privacy get phone_number
|
|
153
|
-
agent-telegram privacy set phone_number allow_contacts # Set privacy
|
|
172
|
+
agent-telegram privacy get --key phone_number # Get privacy setting
|
|
173
|
+
agent-telegram privacy set --key phone_number --rule allow_contacts # Set privacy
|
|
154
174
|
```
|
|
155
175
|
|
|
156
176
|
**Privacy keys:** `status_timestamp`, `phone_number`, `profile_photo`, `forwards`, `phone_call`, `voice_messages`, `about`
|
|
@@ -160,9 +180,21 @@ agent-telegram privacy set phone_number allow_contacts # Set privacy
|
|
|
160
180
|
### Search
|
|
161
181
|
|
|
162
182
|
```bash
|
|
163
|
-
agent-telegram search "query"
|
|
164
|
-
agent-telegram search "query" --
|
|
165
|
-
agent-telegram search "query" --
|
|
183
|
+
agent-telegram search global "query" # Global search
|
|
184
|
+
agent-telegram search global "query" --type bots # Search bots only
|
|
185
|
+
agent-telegram search in-chat "query" --to @user # Search in specific chat
|
|
186
|
+
agent-telegram search in-chat "query" --to @user --type photos # Search photos
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Updates
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
agent-telegram updates # Get pending updates
|
|
193
|
+
agent-telegram updates -l 50 # Get 50 updates
|
|
194
|
+
agent-telegram updates --follow # Continuous polling (JSON Lines)
|
|
195
|
+
agent-telegram updates --follow --type new_message # Filter by type
|
|
196
|
+
agent-telegram updates --follow --interval 5 # Poll every 5 seconds
|
|
197
|
+
agent-telegram updates --follow | jq '.type' # Pipe to jq
|
|
166
198
|
```
|
|
167
199
|
|
|
168
200
|
### Server
|
|
@@ -177,18 +209,21 @@ agent-telegram stop # Stop server
|
|
|
177
209
|
|
|
178
210
|
```bash
|
|
179
211
|
agent-telegram open @user # Quick open chat (alias)
|
|
180
|
-
agent-telegram updates # Get pending updates
|
|
181
|
-
agent-telegram updates -l 50 # Get 50 updates
|
|
182
212
|
```
|
|
183
213
|
|
|
184
|
-
## Options
|
|
214
|
+
## Global Options
|
|
185
215
|
|
|
186
216
|
| Option | Description |
|
|
187
217
|
|--------|-------------|
|
|
188
218
|
| `-s, --socket <path>` | Path to Unix socket (default: `/tmp/agent-telegram.sock`) |
|
|
189
|
-
| `-
|
|
190
|
-
| `-
|
|
191
|
-
|
|
|
219
|
+
| `-q, --quiet` | Suppress status messages (data still goes to stdout) |
|
|
220
|
+
| `-T, --text` | Output human-readable text instead of JSON |
|
|
221
|
+
| `--output <format>` | Output format: `text`, `json`, `ids` |
|
|
222
|
+
| `--fields <list>` | Select output fields (comma-separated) |
|
|
223
|
+
| `--filter <expr>` | Filter results (e.g., `type=channel`, `stars>1000`) |
|
|
224
|
+
| `--dry-run` | Preview action without executing |
|
|
225
|
+
| `-l, --limit <n>` | Limit results (per command) |
|
|
226
|
+
| `-o, --offset <n>` | Offset for pagination (per command) |
|
|
192
227
|
|
|
193
228
|
## Environment Variables
|
|
194
229
|
|
|
@@ -201,34 +236,49 @@ agent-telegram updates -l 50 # Get 50 updates
|
|
|
201
236
|
|
|
202
237
|
Default API credentials are built-in, so you can start using agent-telegram immediately. To use your own credentials, get them at https://my.telegram.org and set via environment variables or `.env` file.
|
|
203
238
|
|
|
204
|
-
##
|
|
239
|
+
## Pipe-Friendly Patterns
|
|
205
240
|
|
|
206
|
-
|
|
241
|
+
All commands output JSON to stdout by default. Status/logs go to stderr.
|
|
207
242
|
|
|
208
243
|
```bash
|
|
209
|
-
|
|
210
|
-
agent-telegram
|
|
211
|
-
|
|
244
|
+
# Get message IDs for piping
|
|
245
|
+
agent-telegram msg list @user --output ids | head -5
|
|
246
|
+
|
|
247
|
+
# Filter and select fields
|
|
248
|
+
agent-telegram chat list --fields peer,title,type --filter type=channel
|
|
249
|
+
|
|
250
|
+
# Continuous monitoring with jq
|
|
251
|
+
agent-telegram updates --follow --type new_message | jq '{from: .data.message.from_name, text: .data.message.text}'
|
|
252
|
+
|
|
253
|
+
# Quiet mode (suppress stderr, data only)
|
|
254
|
+
agent-telegram msg list @user -q | jq '.messages[].text'
|
|
255
|
+
|
|
256
|
+
# Compose commands
|
|
257
|
+
agent-telegram search global "bot" --output ids | head -3
|
|
212
258
|
```
|
|
213
259
|
|
|
214
|
-
|
|
260
|
+
## Usage with AI Agents
|
|
215
261
|
|
|
216
|
-
|
|
217
|
-
# 1. Start server and verify status
|
|
218
|
-
agent-telegram serve
|
|
219
|
-
agent-telegram status --json
|
|
262
|
+
### Just ask the agent
|
|
220
263
|
|
|
221
|
-
|
|
222
|
-
|
|
264
|
+
The simplest approach - just tell your agent to use it:
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
Use agent-telegram to send a message to @username. Run agent-telegram --help to see available commands.
|
|
268
|
+
```
|
|
223
269
|
|
|
224
|
-
|
|
225
|
-
|
|
270
|
+
```markdown
|
|
271
|
+
## Telegram Automation
|
|
226
272
|
|
|
227
|
-
|
|
228
|
-
agent-telegram send --to @username "Hello!" --json
|
|
273
|
+
Use `agent-telegram` for Telegram automation. Run `agent-telegram --help` for all commands.
|
|
229
274
|
|
|
230
|
-
|
|
231
|
-
agent-telegram
|
|
275
|
+
Core workflow:
|
|
276
|
+
1. `agent-telegram serve` - Start background server
|
|
277
|
+
2. `agent-telegram status` - Verify connection
|
|
278
|
+
3. `agent-telegram chat list` - List available chats
|
|
279
|
+
4. `agent-telegram msg list @user` - Read messages
|
|
280
|
+
5. `agent-telegram send @user "message"` - Send message
|
|
281
|
+
6. `agent-telegram updates --follow` - Monitor for new messages
|
|
232
282
|
```
|
|
233
283
|
|
|
234
284
|
## IPC Protocol (JSON-RPC)
|
|
@@ -244,7 +294,7 @@ echo '{"method":"send_message","params":{"peer":"@user","message":"Hi"}}' | nc -
|
|
|
244
294
|
|
|
245
295
|
**Messages:** `send_message`, `send_reply`, `update_message`, `delete_message`, `forward_message`, `get_messages`, `clear_messages`, `clear_history`, `read_messages`, `set_typing`, `get_scheduled_messages`
|
|
246
296
|
|
|
247
|
-
**Media:** `send_photo`, `send_video`, `send_file`, `send_voice`, `send_video_note`, `send_sticker`, `send_gif`, `send_location`, `send_contact`, `send_poll`
|
|
297
|
+
**Media:** `send_photo`, `send_video`, `send_file`, `send_voice`, `send_video_note`, `send_sticker`, `send_gif`, `send_location`, `send_contact`, `send_poll`, `send_dice`
|
|
248
298
|
|
|
249
299
|
**Reactions:** `add_reaction`, `remove_reaction`, `list_reactions`
|
|
250
300
|
|
|
@@ -268,6 +318,8 @@ echo '{"method":"send_message","params":{"peer":"@user","message":"Hi"}}' | nc -
|
|
|
268
318
|
|
|
269
319
|
**Search:** `search_global`, `search_in_chat`
|
|
270
320
|
|
|
321
|
+
**Updates:** `get_updates`
|
|
322
|
+
|
|
271
323
|
**System:** `status`, `shutdown`, `ping`
|
|
272
324
|
|
|
273
325
|
## Architecture
|
|
@@ -316,29 +368,6 @@ agent-telegram --socket /tmp/agent2.sock serve
|
|
|
316
368
|
agent-telegram --socket /tmp/agent1.sock chat list
|
|
317
369
|
```
|
|
318
370
|
|
|
319
|
-
## Usage with AI Agents
|
|
320
|
-
|
|
321
|
-
### Just ask the agent
|
|
322
|
-
|
|
323
|
-
The simplest approach - just tell your agent to use it:
|
|
324
|
-
|
|
325
|
-
```
|
|
326
|
-
Use agent-telegram to send a message to @username. Run agent-telegram --help to see available commands.
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
```markdown
|
|
330
|
-
## Telegram Automation
|
|
331
|
-
|
|
332
|
-
Use `agent-telegram` for Telegram automation. Run `agent-telegram --help` for all commands.
|
|
333
|
-
|
|
334
|
-
Core workflow:
|
|
335
|
-
1. `agent-telegram serve` - Start background server
|
|
336
|
-
2. `agent-telegram status` - Verify connection
|
|
337
|
-
3. `agent-telegram chat list --json` - List available chats
|
|
338
|
-
4. `agent-telegram chat open @user --json` - Read messages
|
|
339
|
-
5. `agent-telegram send --to @user "message"` - Send message
|
|
340
|
-
```
|
|
341
|
-
|
|
342
371
|
## Development
|
|
343
372
|
|
|
344
373
|
See [DEVELOPMENT.md](DEVELOPMENT.md) for:
|
package/bin/run.js
CHANGED
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|