zalo-agent-cli 1.0.21 → 1.0.23
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 +2 -0
- package/package.json +1 -1
- package/src/commands/group.js +12 -0
- package/src/commands/msg.js +29 -0
package/README.md
CHANGED
|
@@ -166,6 +166,7 @@ zalo-agent whoami
|
|
|
166
166
|
| `msg send-card <threadId> <userId> [-t 0\|1] [--phone NUM]` | Send contact card |
|
|
167
167
|
| `msg send-bank <threadId> <accountNum> -b BANK [-n name] [-t 0\|1]` | Send bank card |
|
|
168
168
|
| `msg send-qr-transfer <threadId> <accountNum> -b BANK [-a amount] [-m content] [--template tpl]` | Send VietQR transfer image |
|
|
169
|
+
| `msg send-video <threadId> <videoUrl> --thumb <thumbUrl> [-m caption] [-d ms] [-W px] [-H px]` | Send video from URL |
|
|
169
170
|
| `msg sticker <threadId> <keyword> [-t 0\|1]` | Search and send sticker |
|
|
170
171
|
| `msg react <msgId> <threadId> <emoji> [-t 0\|1]` | React to a message |
|
|
171
172
|
| `msg delete <msgId> <threadId> [-t 0\|1]` | Delete a message |
|
|
@@ -200,6 +201,7 @@ zalo-agent whoami
|
|
|
200
201
|
| `group add-member <groupId> <userIds...>` | Add members |
|
|
201
202
|
| `group remove-member <groupId> <userIds...>` | Remove members |
|
|
202
203
|
| `group rename <groupId> <name>` | Rename |
|
|
204
|
+
| `group upgrade-community <groupId>` | Upgrade group to Zalo Community |
|
|
203
205
|
| `group leave <groupId>` | Leave group |
|
|
204
206
|
| `group join <link>` | Join via invite link |
|
|
205
207
|
|
package/package.json
CHANGED
package/src/commands/group.js
CHANGED
|
@@ -171,6 +171,18 @@ export function registerGroupCommands(program) {
|
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
+
group
|
|
175
|
+
.command("upgrade-community <groupId>")
|
|
176
|
+
.description("Upgrade a group to Zalo Community (requires verified 18+ account)")
|
|
177
|
+
.action(async (groupId) => {
|
|
178
|
+
try {
|
|
179
|
+
const result = await getApi().upgradeGroupToCommunity(groupId);
|
|
180
|
+
output(result, program.opts().json, () => success("Group upgraded to community"));
|
|
181
|
+
} catch (e) {
|
|
182
|
+
error(`Upgrade failed: ${e.message}`);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
174
186
|
group
|
|
175
187
|
.command("leave <groupId>")
|
|
176
188
|
.description("Leave a group")
|
package/src/commands/msg.js
CHANGED
|
@@ -217,6 +217,35 @@ export function registerMsgCommands(program) {
|
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
+
msg.command("send-video <threadId> <videoUrl>")
|
|
221
|
+
.description("Send a video from URL")
|
|
222
|
+
.requiredOption("--thumb <url>", "Thumbnail image URL")
|
|
223
|
+
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
224
|
+
.option("-m, --caption <text>", "Caption text", "")
|
|
225
|
+
.option("-d, --duration <ms>", "Video duration in milliseconds", parseInt)
|
|
226
|
+
.option("-W, --width <px>", "Video width", parseInt, 1280)
|
|
227
|
+
.option("-H, --height <px>", "Video height", parseInt, 720)
|
|
228
|
+
.action(async (threadId, videoUrl, opts) => {
|
|
229
|
+
try {
|
|
230
|
+
info(`Sending video: ${videoUrl}`);
|
|
231
|
+
const result = await getApi().sendVideo(
|
|
232
|
+
{
|
|
233
|
+
videoUrl,
|
|
234
|
+
thumbnailUrl: opts.thumb,
|
|
235
|
+
msg: opts.caption,
|
|
236
|
+
duration: opts.duration,
|
|
237
|
+
width: opts.width,
|
|
238
|
+
height: opts.height,
|
|
239
|
+
},
|
|
240
|
+
threadId,
|
|
241
|
+
Number(opts.type),
|
|
242
|
+
);
|
|
243
|
+
output(result, program.opts().json, () => success(`Video sent to ${threadId}`));
|
|
244
|
+
} catch (e) {
|
|
245
|
+
error(`Send video failed: ${e.message}`);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
220
249
|
msg.command("react <msgId> <threadId> <reaction>")
|
|
221
250
|
.description(
|
|
222
251
|
"React to a message. Reaction codes: :> (haha), /-heart (heart), /-strong (like), :o (wow), :-(( (cry), :-h (angry)",
|