zalo-agent-cli 1.0.26 → 1.0.27
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 +14 -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-link <threadId> <url> [-m caption] [-t 0\|1]` | Send link with auto-preview |
|
|
169
170
|
| `msg send-video <threadId> <videoUrl> --thumb <thumbUrl> [-m caption] [-d ms] [-W px] [-H px]` | Send video from URL |
|
|
170
171
|
| `msg sticker <threadId> <keyword> [-t 0\|1]` | Search and send sticker |
|
|
171
172
|
| `msg react <msgId> <threadId> <emoji> [-t 0\|1]` | React to a message |
|
package/package.json
CHANGED
package/src/commands/msg.js
CHANGED
|
@@ -319,6 +319,20 @@ export function registerMsgCommands(program) {
|
|
|
319
319
|
}
|
|
320
320
|
});
|
|
321
321
|
|
|
322
|
+
msg.command("send-link <threadId> <url>")
|
|
323
|
+
.description("Send a link with auto-preview (title, description, thumbnail)")
|
|
324
|
+
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
325
|
+
.option("-m, --caption <text>", "Caption text")
|
|
326
|
+
.action(async (threadId, url, opts) => {
|
|
327
|
+
try {
|
|
328
|
+
info(`Sending link: ${url}`);
|
|
329
|
+
const result = await getApi().sendLink({ link: url, msg: opts.caption }, threadId, Number(opts.type));
|
|
330
|
+
output(result, program.opts().json, () => success(`Link sent to ${threadId}`));
|
|
331
|
+
} catch (e) {
|
|
332
|
+
error(`Send link failed: ${e.message}`);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
322
336
|
msg.command("send-video <threadId> <videoUrl>")
|
|
323
337
|
.description("Send a video from URL")
|
|
324
338
|
.requiredOption("--thumb <url>", "Thumbnail image URL")
|