zalo-agent-cli 1.0.20 → 1.0.21

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.20",
3
+ "version": "1.0.21",
4
4
  "description": "CLI tool for Zalo automation — multi-account, proxy support, bank transfers, QR payments",
5
5
  "type": "module",
6
6
  "bin": {
@@ -102,8 +102,18 @@ export function registerProfileCommands(program) {
102
102
  const bio = result?.profile?.status || "(empty)";
103
103
  output({ bio }, program.opts().json, () => info(`Bio: ${bio}`));
104
104
  } else {
105
- const result = await getApi().updateProfileBio(text);
106
- output(result, program.opts().json, () => success(`Bio updated to: "${text}"`));
105
+ await getApi().updateProfileBio(text);
106
+ // Verify by reading back (Zalo may cache, so check)
107
+ const verify = await getApi().fetchAccountInfo();
108
+ const newBio = verify?.profile?.status || "";
109
+ if (newBio === text) {
110
+ output({ bio: newBio }, program.opts().json, () => success(`Bio updated to: "${text}"`));
111
+ } else {
112
+ output({ bio: newBio, requested: text }, program.opts().json, () => {
113
+ success(`Bio update request sent: "${text}"`);
114
+ info("Note: Zalo may take time to reflect changes, or bio may not be supported for your account type.");
115
+ });
116
+ }
107
117
  }
108
118
  } catch (e) {
109
119
  error(`Bio update failed: ${e.message}`);
@@ -125,10 +135,16 @@ export function registerProfileCommands(program) {
125
135
  // Fetch current profile to fill missing fields (API requires all 3)
126
136
  const current = await getApi().fetchAccountInfo();
127
137
  const p = current?.profile || {};
138
+ // Convert sdob (DD/MM/YYYY) to YYYY-MM-DD format required by API
139
+ let currentDob = "2000-01-01";
140
+ if (p.sdob) {
141
+ const parts = p.sdob.split("/");
142
+ if (parts.length === 3) currentDob = `${parts[2]}-${parts[1]}-${parts[0]}`;
143
+ }
128
144
  const payload = {
129
145
  profile: {
130
146
  name: opts.name || p.displayName || p.zaloName,
131
- dob: opts.dob || p.sdob || "2000-01-01",
147
+ dob: opts.dob || currentDob,
132
148
  gender: opts.gender !== undefined ? Number(opts.gender) : p.gender ?? 0,
133
149
  },
134
150
  };