zalo-agent-cli 1.0.14 → 1.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zalo-agent-cli",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "CLI tool for Zalo automation — multi-account, proxy support, bank transfers, QR payments",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,16 +13,27 @@ export function registerMsgCommands(program) {
13
13
  msg.command("send <threadId> <message>")
14
14
  .description("Send a text message")
15
15
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
16
+ .option(
17
+ "--mention <specs...>",
18
+ "Mention users in group message. Format: pos:userId:len (e.g. 0:USER_ID:5). Use userId=-1 for @All.",
19
+ )
16
20
  .option(
17
21
  "--react <icon>",
18
22
  "Auto-react to sent message. Codes: :> (haha), /-heart (heart), /-strong (like), :o (wow), :-(( (cry), :-h (angry)",
19
23
  )
20
24
  .action(async (threadId, message, opts) => {
21
25
  try {
22
- // Capture clientId before send zca-js uses Date.now() internally
26
+ // Parse mention specs: "pos:uid:len" { pos, uid, len }
27
+ const mentions = (opts.mention || []).map((spec) => {
28
+ const [pos, uid, len] = spec.split(":");
29
+ return { pos: Number(pos), uid, len: Number(len) };
30
+ });
31
+
32
+ // Build message content object if mentions exist
33
+ const msgContent = mentions.length > 0 ? { msg: message, mentions } : message;
34
+
23
35
  const cliMsgId = String(Date.now());
24
- const result = await getApi().sendMessage(message, threadId, Number(opts.type));
25
- // Include cliMsgId in output for later use with react command
36
+ const result = await getApi().sendMessage(msgContent, threadId, Number(opts.type));
26
37
  result.cliMsgId = cliMsgId;
27
38
  output(result, program.opts().json, () => success("Message sent"));
28
39