@satorijs/adapter-lark 3.10.3 → 3.10.5

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/lib/index.cjs CHANGED
@@ -147,8 +147,10 @@ async function adaptSession(bot, body) {
147
147
  }, "setOption");
148
148
  for (const [key, value] of Object.entries(body.event.action.form_value ?? {})) {
149
149
  if (key.startsWith("@@")) {
150
- if (value) args.push(key.slice(2));
150
+ if (value === false) continue;
151
+ args.push(key.slice(2));
151
152
  } else if (key.startsWith("@")) {
153
+ if (value === false) continue;
152
154
  const [_key] = key.slice(1).split("=", 1);
153
155
  setOption(_key, key.slice(2 + _key.length));
154
156
  } else if (+key * 0 === 0) {
@@ -661,6 +663,7 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
661
663
  content: this.textContent
662
664
  }
663
665
  });
666
+ this.textContent = "";
664
667
  } else if (attrs.type === "submit") {
665
668
  this.flushText(true);
666
669
  await this.render(children);
@@ -677,18 +680,18 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
677
680
  content: attrs.text
678
681
  }
679
682
  });
683
+ this.textContent = "";
680
684
  } else {
681
685
  this.flushText();
682
- await this.render(children);
683
686
  this.card?.elements.push({
684
687
  tag: "action",
685
688
  actions: [{
686
689
  tag: "input",
687
690
  name: attrs.name,
688
691
  width: attrs.width,
689
- label: this.textContent && {
692
+ label: attrs.label && {
690
693
  tag: "plain_text",
691
- content: this.textContent
694
+ content: attrs.label
692
695
  },
693
696
  placeholder: attrs.placeholder && {
694
697
  tag: "plain_text",
@@ -698,7 +701,6 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
698
701
  }]
699
702
  });
700
703
  }
701
- this.textContent = "";
702
704
  } else if (type === "button") {
703
705
  this.card ??= { elements: [] };
704
706
  this.flushText(true);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@satorijs/adapter-lark",
3
3
  "description": "Lark (飞书) Adapter for Satorijs",
4
- "version": "3.10.3",
4
+ "version": "3.10.5",
5
5
  "type": "module",
6
6
  "main": "lib/index.cjs",
7
7
  "types": "lib/index.d.ts",
package/src/message.ts CHANGED
@@ -273,6 +273,7 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
273
273
  content: this.textContent,
274
274
  },
275
275
  })
276
+ this.textContent = ''
276
277
  } else if (attrs.type === 'submit') {
277
278
  this.flushText(true)
278
279
  await this.render(children)
@@ -289,18 +290,18 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
289
290
  content: attrs.text,
290
291
  },
291
292
  })
293
+ this.textContent = ''
292
294
  } else {
293
295
  this.flushText()
294
- await this.render(children)
295
296
  this.card?.elements.push({
296
297
  tag: 'action',
297
298
  actions: [{
298
299
  tag: 'input',
299
300
  name: attrs.name,
300
301
  width: attrs.width,
301
- label: this.textContent && {
302
+ label: attrs.label && {
302
303
  tag: 'plain_text',
303
- content: this.textContent,
304
+ content: attrs.label,
304
305
  },
305
306
  placeholder: attrs.placeholder && {
306
307
  tag: 'plain_text',
@@ -310,7 +311,6 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
310
311
  }],
311
312
  })
312
313
  }
313
- this.textContent = ''
314
314
  } else if (type === 'button') {
315
315
  this.card ??= { elements: [] }
316
316
  this.flushText(true)
package/src/utils.ts CHANGED
@@ -267,8 +267,10 @@ export async function adaptSession<C extends Context>(bot: LarkBot<C>, body: Eve
267
267
  }
268
268
  for (const [key, value] of Object.entries(body.event.action.form_value ?? {})) {
269
269
  if (key.startsWith('@@')) {
270
- if (value) args.push(key.slice(2))
270
+ if (value === false) continue
271
+ args.push(key.slice(2))
271
272
  } else if (key.startsWith('@')) {
273
+ if (value === false) continue
272
274
  const [_key] = key.slice(1).split('=', 1)
273
275
  setOption(_key, key.slice(2 + _key.length))
274
276
  } else if (+key * 0 === 0) {