@satorijs/adapter-lark 3.8.4 → 3.8.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
@@ -394,6 +394,14 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
394
394
  async post(data) {
395
395
  try {
396
396
  let resp;
397
+ let quote = this.quote;
398
+ const payload = this.options?.session?.lark;
399
+ if (!quote && payload?.type === "im.message.receive_v1" && payload.event.message.thread_id) {
400
+ quote = {
401
+ id: payload.event.message.message_id,
402
+ replyInThread: true
403
+ };
404
+ }
397
405
  if (this.editMessageIds) {
398
406
  const messageId = this.editMessageIds.pop();
399
407
  if (!messageId) throw new Error("No message to edit");
@@ -403,10 +411,10 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
403
411
  } else {
404
412
  await this.bot.internal.updateImMessage(messageId, data);
405
413
  }
406
- } else if (this.quote?.id) {
407
- resp = await this.bot.internal.replyImMessage(this.quote.id, {
414
+ } else if (quote?.id) {
415
+ resp = await this.bot.internal.replyImMessage(quote.id, {
408
416
  ...data,
409
- reply_in_thread: this.quote.replyInThread
417
+ reply_in_thread: quote.replyInThread
410
418
  });
411
419
  } else {
412
420
  data.receive_id = this.channelId;
package/lib/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { Lark, Lark as Feishu };
5
5
  export default LarkBot;
6
6
  declare module '@satorijs/core' {
7
7
  interface Session {
8
- feishu: Lark.Internal;
9
- lark: Lark.Internal;
8
+ feishu: Lark.Internal & Lark.EventPayload;
9
+ lark: Lark.Internal & Lark.EventPayload;
10
10
  }
11
11
  }
@@ -16,6 +16,7 @@ declare module '../event' {
16
16
  message_id: string;
17
17
  root_id: string;
18
18
  parent_id: string;
19
+ thread_id: string;
19
20
  create_time: string;
20
21
  chat_id: string;
21
22
  chat_type: string;
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.8.4",
4
+ "version": "3.8.5",
5
5
  "type": "module",
6
6
  "main": "lib/index.cjs",
7
7
  "types": "lib/index.d.ts",
@@ -35,10 +35,10 @@
35
35
  ],
36
36
  "devDependencies": {
37
37
  "@cordisjs/plugin-server": "^0.2.5",
38
- "@satorijs/core": "^4.3.3",
38
+ "@satorijs/core": "^4.3.4",
39
39
  "cordis": "^3.18.1"
40
40
  },
41
41
  "peerDependencies": {
42
- "@satorijs/core": "^4.3.3"
42
+ "@satorijs/core": "^4.3.4"
43
43
  }
44
44
  }
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ export default LarkBot
9
9
 
10
10
  declare module '@satorijs/core' {
11
11
  interface Session {
12
- feishu: Lark.Internal
13
- lark: Lark.Internal
12
+ feishu: Lark.Internal & Lark.EventPayload
13
+ lark: Lark.Internal & Lark.EventPayload
14
14
  }
15
15
  }
package/src/message.ts CHANGED
@@ -16,6 +16,14 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
16
16
  async post(data?: any) {
17
17
  try {
18
18
  let resp: Lark.Message
19
+ let quote = this.quote
20
+ const payload = this.options?.session?.lark
21
+ if (!quote && payload?.type === 'im.message.receive_v1' && payload.event.message.thread_id) {
22
+ quote = {
23
+ id: payload.event.message.message_id,
24
+ replyInThread: true,
25
+ }
26
+ }
19
27
  if (this.editMessageIds) {
20
28
  const messageId = this.editMessageIds.pop()
21
29
  if (!messageId) throw new Error('No message to edit')
@@ -25,10 +33,10 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
25
33
  } else {
26
34
  await this.bot.internal.updateImMessage(messageId, data)
27
35
  }
28
- } else if (this.quote?.id) {
29
- resp = await this.bot.internal.replyImMessage(this.quote.id, {
36
+ } else if (quote?.id) {
37
+ resp = await this.bot.internal.replyImMessage(quote.id, {
30
38
  ...data,
31
- reply_in_thread: this.quote.replyInThread,
39
+ reply_in_thread: quote.replyInThread,
32
40
  })
33
41
  } else {
34
42
  data.receive_id = this.channelId
@@ -18,6 +18,7 @@ declare module '../event' {
18
18
  message_id: string
19
19
  root_id: string
20
20
  parent_id: string
21
+ thread_id: string
21
22
  create_time: string
22
23
  chat_id: string
23
24
  chat_type: string