zalo-agent-cli 1.0.15 → 1.0.16
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 +1 -1
- package/src/commands/msg.js +18 -0
package/package.json
CHANGED
package/src/commands/msg.js
CHANGED
|
@@ -250,6 +250,24 @@ export function registerMsgCommands(program) {
|
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
|
|
253
|
+
msg.command("undo <msgId> <threadId>")
|
|
254
|
+
.description("Recall/undo a message for both sides (like Zalo app recall). Requires cliMsgId.")
|
|
255
|
+
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
256
|
+
.option("-c, --cli-msg-id <id>", "Client message ID (required, get from listen --json or send --json)")
|
|
257
|
+
.action(async (msgId, threadId, opts) => {
|
|
258
|
+
try {
|
|
259
|
+
if (!opts.cliMsgId) {
|
|
260
|
+
error("cliMsgId is required for undo. Get it from: listen --json or send --json output.");
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const payload = { msgId, cliMsgId: opts.cliMsgId };
|
|
264
|
+
const result = await getApi().undo(payload, threadId, Number(opts.type));
|
|
265
|
+
output(result, program.opts().json, () => success("Message recalled (undone)"));
|
|
266
|
+
} catch (e) {
|
|
267
|
+
error(`Undo failed: ${e.message}`);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
253
271
|
msg.command("forward <msgId> <threadId>")
|
|
254
272
|
.description("Forward a message to another thread")
|
|
255
273
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|