zalo_bot 1.0.1 → 1.0.2
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/actions.ts +1 -1
- package/src/onboarding.ts +12 -12
package/package.json
CHANGED
package/src/actions.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { extractToolSend, jsonResult, readStringParam } from "openclaw/plugin-sd
|
|
|
7
7
|
import { listEnabledZaloAccounts } from "./accounts.js";
|
|
8
8
|
import { sendMessageZalo } from "./send.js";
|
|
9
9
|
|
|
10
|
-
const providerId = "
|
|
10
|
+
const providerId = "zalo_bot";
|
|
11
11
|
|
|
12
12
|
function listEnabledAccounts(cfg: OpenClawConfig) {
|
|
13
13
|
return listEnabledZaloAccounts(cfg).filter(
|
package/src/onboarding.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "openclaw/plugin-sdk";
|
|
14
14
|
import { listZaloAccountIds, resolveDefaultZaloAccountId, resolveZaloAccount } from "./accounts.js";
|
|
15
15
|
|
|
16
|
-
const channel = "
|
|
16
|
+
const channel = "zalo_bot" as const;
|
|
17
17
|
|
|
18
18
|
type UpdateMode = "polling" | "webhook";
|
|
19
19
|
|
|
@@ -27,7 +27,7 @@ function setZaloDmPolicy(
|
|
|
27
27
|
...cfg,
|
|
28
28
|
channels: {
|
|
29
29
|
...cfg.channels,
|
|
30
|
-
|
|
30
|
+
zalo_bot: {
|
|
31
31
|
...cfg.channels?.zalo_bot,
|
|
32
32
|
dmPolicy,
|
|
33
33
|
...(allowFrom ? { allowFrom } : {}),
|
|
@@ -57,7 +57,7 @@ function setZaloUpdateMode(
|
|
|
57
57
|
...cfg,
|
|
58
58
|
channels: {
|
|
59
59
|
...cfg.channels,
|
|
60
|
-
|
|
60
|
+
zalo_bot: rest,
|
|
61
61
|
},
|
|
62
62
|
} as OpenClawConfig;
|
|
63
63
|
}
|
|
@@ -69,7 +69,7 @@ function setZaloUpdateMode(
|
|
|
69
69
|
...cfg,
|
|
70
70
|
channels: {
|
|
71
71
|
...cfg.channels,
|
|
72
|
-
|
|
72
|
+
zalo_bot: {
|
|
73
73
|
...cfg.channels?.zalo_bot,
|
|
74
74
|
accounts,
|
|
75
75
|
},
|
|
@@ -82,7 +82,7 @@ function setZaloUpdateMode(
|
|
|
82
82
|
...cfg,
|
|
83
83
|
channels: {
|
|
84
84
|
...cfg.channels,
|
|
85
|
-
|
|
85
|
+
zalo_bot: {
|
|
86
86
|
...cfg.channels?.zalo_bot,
|
|
87
87
|
webhookUrl,
|
|
88
88
|
webhookSecret,
|
|
@@ -103,7 +103,7 @@ function setZaloUpdateMode(
|
|
|
103
103
|
...cfg,
|
|
104
104
|
channels: {
|
|
105
105
|
...cfg.channels,
|
|
106
|
-
|
|
106
|
+
zalo_bot: {
|
|
107
107
|
...cfg.channels?.zalo_bot,
|
|
108
108
|
accounts,
|
|
109
109
|
},
|
|
@@ -155,7 +155,7 @@ async function promptZaloAllowFrom(params: {
|
|
|
155
155
|
...cfg,
|
|
156
156
|
channels: {
|
|
157
157
|
...cfg.channels,
|
|
158
|
-
|
|
158
|
+
zalo_bot: {
|
|
159
159
|
...cfg.channels?.zalo_bot,
|
|
160
160
|
enabled: true,
|
|
161
161
|
dmPolicy: "allowlist",
|
|
@@ -169,7 +169,7 @@ async function promptZaloAllowFrom(params: {
|
|
|
169
169
|
...cfg,
|
|
170
170
|
channels: {
|
|
171
171
|
...cfg.channels,
|
|
172
|
-
|
|
172
|
+
zalo_bot: {
|
|
173
173
|
...cfg.channels?.zalo_bot,
|
|
174
174
|
enabled: true,
|
|
175
175
|
accounts: {
|
|
@@ -228,7 +228,7 @@ export const zaloOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
228
228
|
shouldPromptAccountIds,
|
|
229
229
|
forceAllowFrom,
|
|
230
230
|
}) => {
|
|
231
|
-
const zaloOverride = accountOverrides.
|
|
231
|
+
const zaloOverride = accountOverrides.zalo_bot?.trim();
|
|
232
232
|
const defaultZaloAccountId = resolveDefaultZaloAccountId(cfg);
|
|
233
233
|
let zaloAccountId = zaloOverride ? normalizeAccountId(zaloOverride) : defaultZaloAccountId;
|
|
234
234
|
if (shouldPromptAccountIds && !zaloOverride) {
|
|
@@ -265,7 +265,7 @@ export const zaloOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
265
265
|
...next,
|
|
266
266
|
channels: {
|
|
267
267
|
...next.channels,
|
|
268
|
-
|
|
268
|
+
zalo_bot: {
|
|
269
269
|
...next.channels?.zalo_bot,
|
|
270
270
|
enabled: true,
|
|
271
271
|
},
|
|
@@ -307,7 +307,7 @@ export const zaloOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
307
307
|
...next,
|
|
308
308
|
channels: {
|
|
309
309
|
...next.channels,
|
|
310
|
-
|
|
310
|
+
zalo_bot: {
|
|
311
311
|
...next.channels?.zalo_bot,
|
|
312
312
|
enabled: true,
|
|
313
313
|
botToken: token,
|
|
@@ -319,7 +319,7 @@ export const zaloOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
319
319
|
...next,
|
|
320
320
|
channels: {
|
|
321
321
|
...next.channels,
|
|
322
|
-
|
|
322
|
+
zalo_bot: {
|
|
323
323
|
...next.channels?.zalo_bot,
|
|
324
324
|
enabled: true,
|
|
325
325
|
accounts: {
|