@openclaw-china/wecom-app 2026.3.2 → 2026.3.3
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/dist/index.js +37 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8599,25 +8599,37 @@ var wecomAppPlugin = {
|
|
|
8599
8599
|
* 主动发送文本消息
|
|
8600
8600
|
*/
|
|
8601
8601
|
sendText: async (params) => {
|
|
8602
|
-
const
|
|
8603
|
-
if (!
|
|
8602
|
+
const parsed = parseDirectTarget(params.to);
|
|
8603
|
+
if (!parsed) {
|
|
8604
8604
|
return {
|
|
8605
8605
|
channel: "wecom-app",
|
|
8606
8606
|
ok: false,
|
|
8607
8607
|
messageId: "",
|
|
8608
|
-
error: new Error(
|
|
8608
|
+
error: new Error(`Unsupported target for WeCom App: ${params.to}`)
|
|
8609
8609
|
};
|
|
8610
8610
|
}
|
|
8611
|
-
const
|
|
8612
|
-
|
|
8611
|
+
const accountId = parsed.accountId ?? params.accountId;
|
|
8612
|
+
const account = resolveWecomAppAccount({ cfg: params.cfg, accountId });
|
|
8613
|
+
if (parsed.accountId && accountId && !params.cfg.channels?.["wecom-app"]?.accounts?.[accountId]) {
|
|
8614
|
+
console.error(`[wecom-app] Account "${accountId}" not found in configuration`);
|
|
8613
8615
|
return {
|
|
8614
8616
|
channel: "wecom-app",
|
|
8615
8617
|
ok: false,
|
|
8616
8618
|
messageId: "",
|
|
8617
|
-
error: new Error(`
|
|
8619
|
+
error: new Error(`Account "${accountId}" not configured`)
|
|
8620
|
+
};
|
|
8621
|
+
}
|
|
8622
|
+
if (!account.canSendActive) {
|
|
8623
|
+
return {
|
|
8624
|
+
channel: "wecom-app",
|
|
8625
|
+
ok: false,
|
|
8626
|
+
messageId: "",
|
|
8627
|
+
error: new Error("Account not configured for active sending (missing corpId, corpSecret, or agentId)")
|
|
8618
8628
|
};
|
|
8619
8629
|
}
|
|
8620
8630
|
const target = { userId: parsed.userId };
|
|
8631
|
+
console.log(`[wecom-app] Account resolved: canSendActive=${account.canSendActive}`);
|
|
8632
|
+
console.log("[wecom-app] Target parsed:", target);
|
|
8621
8633
|
try {
|
|
8622
8634
|
const result = await sendWecomAppMessage(account, target, params.text);
|
|
8623
8635
|
return {
|
|
@@ -8640,29 +8652,38 @@ var wecomAppPlugin = {
|
|
|
8640
8652
|
* OpenClaw outbound 适配器要求的接口
|
|
8641
8653
|
*/
|
|
8642
8654
|
sendMedia: async (params) => {
|
|
8643
|
-
|
|
8655
|
+
const parsed = parseDirectTarget(params.to);
|
|
8656
|
+
if (!parsed) {
|
|
8657
|
+
return {
|
|
8658
|
+
channel: "wecom-app",
|
|
8659
|
+
ok: false,
|
|
8660
|
+
messageId: "",
|
|
8661
|
+
error: new Error(`Unsupported target for WeCom App: ${params.to}`)
|
|
8662
|
+
};
|
|
8663
|
+
}
|
|
8664
|
+
const accountId = parsed.accountId ?? params.accountId;
|
|
8644
8665
|
const account = resolveWecomAppAccount({
|
|
8645
8666
|
cfg: params.cfg,
|
|
8646
|
-
accountId
|
|
8667
|
+
accountId
|
|
8647
8668
|
});
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
const error = new Error("Account not configured for active sending (missing corpId, corpSecret, or agentId)");
|
|
8651
|
-
console.error(`[wecom-app] sendMedia error:`, error.message);
|
|
8669
|
+
if (parsed.accountId && accountId && !params.cfg.channels?.["wecom-app"]?.accounts?.[accountId]) {
|
|
8670
|
+
console.error(`[wecom-app] Account "${accountId}" not found in configuration`);
|
|
8652
8671
|
return {
|
|
8653
8672
|
channel: "wecom-app",
|
|
8654
8673
|
ok: false,
|
|
8655
8674
|
messageId: "",
|
|
8656
|
-
error
|
|
8675
|
+
error: new Error(`Account "${accountId}" not configured`)
|
|
8657
8676
|
};
|
|
8658
8677
|
}
|
|
8659
|
-
|
|
8660
|
-
if (!
|
|
8678
|
+
console.log(`[wecom-app] Account resolved: canSendActive=${account.canSendActive}`);
|
|
8679
|
+
if (!account.canSendActive) {
|
|
8680
|
+
const error = new Error("Account not configured for active sending (missing corpId, corpSecret, or agentId)");
|
|
8681
|
+
console.error(`[wecom-app] sendMedia error:`, error.message);
|
|
8661
8682
|
return {
|
|
8662
8683
|
channel: "wecom-app",
|
|
8663
8684
|
ok: false,
|
|
8664
8685
|
messageId: "",
|
|
8665
|
-
error
|
|
8686
|
+
error
|
|
8666
8687
|
};
|
|
8667
8688
|
}
|
|
8668
8689
|
const target = { userId: parsed.userId };
|