zalo-agent-cli 1.0.21 → 1.0.22
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 +1 -0
- package/package.json +1 -1
- 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 |
|
package/package.json
CHANGED
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)",
|